Skip to content

Commit 90ca22f

Browse files
author
dlsmith
committed
DynamicJava: Updated plt.jar; removed unnecessary redundant casts (noted by javac 6) -- some remain, because they're produced by javacc (might be fixed with version 4.1) and astgen (should be fixed in current version, but migrating will take some work).
git-svn-id: file:///tmp/test-svn/trunk@4554 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent fa20bba commit 90ca22f

File tree

10 files changed

+55
-54
lines changed

10 files changed

+55
-54
lines changed

dynamicjava/lib/plt.jar

145 KB
Binary file not shown.

dynamicjava/lib/readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildlib/*.jar: Binaries used in the build process, but that should not be part
55

66
VERSIONS:
77

8-
plt.jar: plt-20080506-2028
8+
plt.jar: plt-20080709-1847
99
retroweaver-rt-1.2.3.jar: Retroweaver 1.2.3
1010
buildlib/ant-contrib.jar: ANT Contrib 1.0b2
1111
buildlib/astgen.jar: astgen-20060419-1726

dynamicjava/src/edu/rice/cs/dynamicjava/interpreter/ExpressionChecker.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575

7676
import java.util.*;
7777
import edu.rice.cs.plt.iter.IterUtil;
78+
import edu.rice.cs.plt.collect.CollectUtil;
7879
import edu.rice.cs.plt.tuple.Pair;
7980
import edu.rice.cs.plt.lambda.Lambda;
8081
import edu.rice.cs.plt.lambda.Lambda2;
@@ -512,7 +513,7 @@ else if (ts.containsClass(classType, memberName.image())) {
512513

513514
// TODO: Check accessibility of method
514515
checkThrownExceptions(inv.thrown(), node);
515-
node.setArguments(IterUtil.asList(inv.args()));
516+
node.setArguments(CollectUtil.makeList(inv.args()));
516517
setMethod(node, inv.method());
517518
if (!inv.method().isStatic()) {
518519
setDJClass(node, t.ofClass());
@@ -578,7 +579,7 @@ else if (ts.containsClass(classType, memberName.image())) {
578579
// TODO: Check accessibility of method
579580
checkThrownExceptions(inv.thrown(), node);
580581
node.setExpression(inv.object());
581-
node.setArguments(IterUtil.asList(inv.args()));
582+
node.setArguments(CollectUtil.makeList(inv.args()));
582583
setMethod(node, inv.method());
583584
Type result = ts.capture(inv.returnType());
584585
debug.logValue("Type of method call " + node.getMethodName(), ts.wrap(result));
@@ -619,7 +620,7 @@ else if (ts.containsClass(classType, memberName.image())) {
619620
TypeSystem.MethodInvocation inv = ts.lookupMethod(obj, node.getMethodName(), targs, args);
620621
// TODO: Check accessibility of method
621622
checkThrownExceptions(inv.thrown(), node);
622-
node.setArguments(IterUtil.asList(inv.args()));
623+
node.setArguments(CollectUtil.makeList(inv.args()));
623624
setMethod(node, inv.method());
624625
setDJClass(node, context.getThis());
625626
Type result = ts.capture(inv.returnType());
@@ -657,7 +658,7 @@ else if (ts.containsClass(classType, memberName.image())) {
657658
TypeSystem.MethodInvocation inv = ts.lookupStaticMethod(t, node.getMethodName(), targs, args);
658659
// TODO: Check accessibility of method
659660
checkThrownExceptions(inv.thrown(), node);
660-
node.setArguments(IterUtil.asList(inv.args()));
661+
node.setArguments(CollectUtil.makeList(inv.args()));
661662
setMethod(node, inv.method());
662663
Type result = ts.capture(inv.returnType());
663664
debug.logValue("Type of method call " + node.getMethodName(), ts.wrap(result));
@@ -763,7 +764,7 @@ private void addRuntimeCheck(Node node, Type expectedType, Type declaredActualTy
763764
TypeSystem.ConstructorInvocation inv = ts.lookupConstructor(t, targs, args);
764765
// TODO: Check accessibility of constructor
765766
checkThrownExceptions(inv.thrown(), node);
766-
node.setArguments(IterUtil.asList(inv.args()));
767+
node.setArguments(CollectUtil.makeList(inv.args()));
767768
setConstructor(node, inv.constructor());
768769
return setType(node, t);
769770
}
@@ -802,7 +803,7 @@ private void addRuntimeCheck(Node node, Type expectedType, Type declaredActualTy
802803
TypeSystem.ConstructorInvocation inv = ts.lookupConstructor(t, targs, args);
803804
// TODO: Check accessibility of constructor
804805
checkThrownExceptions(inv.thrown(), node);
805-
node.setArguments(IterUtil.asList(inv.args()));
806+
node.setArguments(CollectUtil.makeList(inv.args()));
806807
}
807808
catch (InvalidTypeArgumentException e) {
808809
throw new ExecutionError("type.argument", node);
@@ -854,7 +855,7 @@ private void addRuntimeCheck(Node node, Type expectedType, Type declaredActualTy
854855
TypeSystem.ConstructorInvocation inv = ts.lookupConstructor(t, targs, args);
855856
// TODO: Check accessibility of constructor
856857
checkThrownExceptions(inv.thrown(), node);
857-
node.setArguments(IterUtil.asList(inv.args()));
858+
node.setArguments(CollectUtil.makeList(inv.args()));
858859
setConstructor(node, inv.constructor());
859860
return setType(node, t);
860861
}
@@ -908,7 +909,7 @@ private void addRuntimeCheck(Node node, Type expectedType, Type declaredActualTy
908909
TypeSystem.ConstructorInvocation inv = ts.lookupConstructor(t, targs, args);
909910
// TODO: Check accessibility of constructor
910911
checkThrownExceptions(inv.thrown(), node);
911-
node.setArguments(IterUtil.asList(inv.args()));
912+
node.setArguments(CollectUtil.makeList(inv.args()));
912913
}
913914
catch (InvalidTypeArgumentException e) {
914915
throw new ExecutionError("type.argument", node);

dynamicjava/src/edu/rice/cs/dynamicjava/interpreter/TreeCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ public BindingsFactory makeBindingsFactory(RuntimeBindings bindings) {
13101310

13111311
private RuntimeBindings bindArgs(RuntimeBindings parent, List<FormalParameter> params,
13121312
Object[] args) {
1313-
return new RuntimeBindings(parent, extractVars(params), IterUtil.make(args));
1313+
return new RuntimeBindings(parent, extractVars(params), IterUtil.asIterable(args));
13141314
}
13151315

13161316
private Object evaluateExpression(Expression exp, RuntimeBindings bindings) throws Throwable {

dynamicjava/src/edu/rice/cs/dynamicjava/symbol/ExtendedTypeSystem.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public class ExtendedTypeSystem extends TypeSystem {
7878
};
7979

8080
private static final Predicate<Type> IS_ARRAY_PRED = new Predicate<Type>() {
81-
public Boolean value(Type t) { return t.apply(IS_ARRAY); }
81+
public boolean contains(Type t) { return t.apply(IS_ARRAY); }
8282
};
8383

8484
/**
@@ -233,7 +233,7 @@ public Boolean defaultCase(final Type subT) {
233233
if (subT instanceof BottomType) { return true; }
234234
else {
235235
return IterUtil.and(superT.ofTypes(), new Predicate<Type>() {
236-
public Boolean value(Type t) { return isSubtype(subT, t, stack); }
236+
public boolean contains(Type t) { return isSubtype(subT, t, stack); }
237237
});
238238
}
239239
}
@@ -242,7 +242,7 @@ public Boolean defaultCase(final Type subT) {
242242
return subT.apply(new TypeAbstractVisitor<Boolean>() {
243243
@Override public Boolean defaultCase(Type t) {
244244
return IterUtil.or(superT.ofTypes(), new Predicate<Type>() {
245-
public Boolean value(Type t) { return isSubtype(subT, t, stack); }
245+
public boolean contains(Type t) { return isSubtype(subT, t, stack); }
246246
});
247247
}
248248
public Boolean forVariableType(VariableType t) { return defaultCase(subT) ? true : null; }
@@ -391,13 +391,13 @@ public Boolean forVariableType(final VariableType subT) {
391391

392392
public Boolean forIntersectionType(IntersectionType subT) {
393393
return IterUtil.or(subT.ofTypes(), new Predicate<Type>() {
394-
public Boolean value(Type t) { return isSubtype(t, superT, stack); }
394+
public boolean contains(Type t) { return isSubtype(t, superT, stack); }
395395
});
396396
}
397397

398398
public Boolean forUnionType(UnionType subT) {
399399
return IterUtil.and(subT.ofTypes(), new Predicate<Type>() {
400-
public Boolean value(Type t) { return isSubtype(t, superT, stack); }
400+
public boolean contains(Type t) { return isSubtype(t, superT, stack); }
401401
});
402402
}
403403

@@ -1140,7 +1140,7 @@ private Expression unbox(Expression exp, String methodName) {
11401140
try {
11411141
ObjectMethodInvocation inv = lookupMethod(exp, methodName, EMPTY_TYPE_ITERABLE, EMPTY_EXPRESSION_ITERABLE);
11421142
result.setExpression(inv.object());
1143-
result.setArguments(IterUtil.asList(inv.args()));
1143+
result.setArguments(CollectUtil.makeList(inv.args()));
11441144
NodeProperties.setMethod(result, inv.method());
11451145
NodeProperties.setType(result, capture(inv.returnType()));
11461146
return result;
@@ -1186,7 +1186,7 @@ private Expression box(Expression exp, ClassType boxedType) {
11861186
exp.getEndLine(), exp.getEndColumn());
11871187
try {
11881188
MethodInvocation inv = lookupStaticMethod(boxedType, "valueOf", EMPTY_TYPE_ITERABLE, arguments);
1189-
m.setArguments(IterUtil.asList(inv.args()));
1189+
m.setArguments(CollectUtil.makeList(inv.args()));
11901190
NodeProperties.setMethod(m, inv.method());
11911191
NodeProperties.setType(m, capture(inv.returnType()));
11921192
return m;
@@ -1198,7 +1198,7 @@ private Expression box(Expression exp, ClassType boxedType) {
11981198
exp.getBeginColumn(), exp.getEndLine(), exp.getEndColumn());
11991199
try {
12001200
ConstructorInvocation inv = lookupConstructor(boxedType, EMPTY_TYPE_ITERABLE, arguments);
1201-
k.setArguments(IterUtil.asList(inv.args()));
1201+
k.setArguments(CollectUtil.makeList(inv.args()));
12021202
NodeProperties.setConstructor(k, inv.constructor());
12031203
NodeProperties.setType(k, boxedType);
12041204
return k;
@@ -1579,7 +1579,7 @@ private Expression makeArray(ArrayType arrayType, Iterable<? extends Expression>
15791579
// possible in general, but possible in situations in which this method is called), or
15801580
// is an "empty" type name sufficient?
15811581
NodeProperties.setType(tn, arrayType.ofType());
1582-
ArrayInitializer init = new ArrayInitializer(IterUtil.asList(elements));
1582+
ArrayInitializer init = new ArrayInitializer(CollectUtil.makeList(elements));
15831583
NodeProperties.setType(init, arrayType);
15841584
NodeProperties.setErasedType(init, erasedType);
15851585
Expression result = new ArrayAllocation(tn, new ArrayAllocation.TypeDescriptor(new ArrayList<Expression>(0),
@@ -1812,7 +1812,7 @@ private Iterable<Type> inferTypeArguments(Iterable<? extends VariableType> tpara
18121812
//debug.logValues("Beginning inferTypeArguments", new String[]{ "tparams", "params", "args" },
18131813
// wrap(tparams), wrap(params), wrap(args));
18141814
RecursionStack3<Type, Type, InferenceMode> stack = RecursionStack3.make();
1815-
Set<? extends VariableType> tparamSet = CollectUtil.asSet(tparams);
1815+
Set<? extends VariableType> tparamSet = CollectUtil.makeSet(tparams);
18161816

18171817
ConstraintSet constraintsBuilder = EMPTY_CONSTRAINTS;
18181818
for (Pair<Type, Type> pair : IterUtil.zip(args, params)) {
@@ -2959,7 +2959,7 @@ class LookupMethod extends TypeAbstractVisitor<Iterable<ObjectMethodInvocation>>
29592959

29602960
public LookupMethod(final boolean includePrivate) {
29612961
_matchMethod = new Predicate<DJMethod>() {
2962-
public Boolean value(DJMethod m) {
2962+
public boolean contains(DJMethod m) {
29632963
if (m.declaredName().equals(name)) {
29642964
return includePrivate || !m.accessibility().equals(Access.PRIVATE);
29652965
}
@@ -3078,7 +3078,7 @@ class LookupMethod extends TypeAbstractVisitor<Iterable<StaticMethodInvocation>>
30783078

30793079
public LookupMethod(final boolean includePrivate) {
30803080
_matchMethod = new Predicate<DJMethod>() {
3081-
public Boolean value(DJMethod m) {
3081+
public boolean contains(DJMethod m) {
30823082
if (m.declaredName().equals(name)) {
30833083
if (includePrivate) { return m.isStatic(); }
30843084
else { return m.isStatic() && !m.accessibility().equals(Access.PRIVATE); }
@@ -3354,7 +3354,7 @@ public boolean containsClass(Type t, final String name) {
33543354
Lambda<Boolean, Predicate<DJClass>> makePred = new Lambda<Boolean, Predicate<DJClass>>() {
33553355
public Predicate<DJClass> value(final Boolean includePrivate) {
33563356
return new Predicate<DJClass>() {
3357-
public Boolean value(DJClass c) {
3357+
public boolean contains(DJClass c) {
33583358
if (c.declaredName().equals(name)) {
33593359
return includePrivate || !c.accessibility().equals(Access.PRIVATE);
33603360
}
@@ -3371,7 +3371,7 @@ public boolean containsStaticClass(Type t, final String name) {
33713371
Lambda<Boolean, Predicate<DJClass>> makePred = new Lambda<Boolean, Predicate<DJClass>>() {
33723372
public Predicate<DJClass> value(final Boolean includePrivate) {
33733373
return new Predicate<DJClass>() {
3374-
public Boolean value(DJClass c) {
3374+
public boolean contains(DJClass c) {
33753375
if (c.declaredName().equals(name)) {
33763376
if (includePrivate) { return c.isStatic(); }
33773377
else { return c.isStatic() && !c.accessibility().equals(Access.PRIVATE); }
@@ -3419,7 +3419,7 @@ public ClassType lookupClass(Type t, final String name, Iterable<? extends Type>
34193419
Lambda<Boolean, Predicate<DJClass>> makePred = new Lambda<Boolean, Predicate<DJClass>>() {
34203420
public Predicate<DJClass> value(final Boolean includePrivate) {
34213421
return new Predicate<DJClass>() {
3422-
public Boolean value(DJClass c) {
3422+
public boolean contains(DJClass c) {
34233423
if (c.declaredName().equals(name)) {
34243424
return includePrivate || !c.accessibility().equals(Access.PRIVATE);
34253425
}
@@ -3451,7 +3451,7 @@ public ClassType lookupStaticClass(Type t, final String name, final Iterable<? e
34513451
Lambda<Boolean, Predicate<DJClass>> makePred = new Lambda<Boolean, Predicate<DJClass>>() {
34523452
public Predicate<DJClass> value(final Boolean includePrivate) {
34533453
return new Predicate<DJClass>() {
3454-
public Boolean value(DJClass c) {
3454+
public boolean contains(DJClass c) {
34553455
if (c.declaredName().equals(name)) {
34563456
if (includePrivate) { return c.isStatic(); }
34573457
else { return c.isStatic() && !c.accessibility().equals(Access.PRIVATE); }

dynamicjava/src/edu/rice/cs/dynamicjava/symbol/Java5Class.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,39 @@ public DJClass declaringClass() {
3030

3131
/** List all type variables declared by this class (but not by its enclosing classes) */
3232
public Iterable<VariableType> declaredTypeParameters() {
33-
return IterUtil.mapSnapshot(IterUtil.make(_c.getTypeParameters()), CONVERT_VAR);
33+
return IterUtil.mapSnapshot(IterUtil.asIterable(_c.getTypeParameters()), CONVERT_VAR);
3434
}
3535

3636
/** List the declared supertypes of this class */
3737
public Iterable<Type> declaredSupertypes() {
3838
Type superC = immediateSuperclass();
39-
Iterable<Type> superIs = IterUtil.mapSnapshot(IterUtil.make(_c.getGenericInterfaces()), CONVERT_TYPE);
39+
Iterable<Type> superIs = IterUtil.mapSnapshot(IterUtil.asIterable(_c.getGenericInterfaces()), CONVERT_TYPE);
4040
return superC == null ? superIs : IterUtil.compose(superC, superIs);
4141
}
4242

4343
public Iterable<DJField> declaredFields() {
4444
// CONVERT_FIELD is shadowed here to create a Java5Field
45-
return IterUtil.mapSnapshot(IterUtil.make(_c.getDeclaredFields()), CONVERT_FIELD);
45+
return IterUtil.mapSnapshot(IterUtil.asIterable(_c.getDeclaredFields()), CONVERT_FIELD);
4646
}
4747

4848
public Iterable<DJConstructor> declaredConstructors() {
4949
// CONVERT_CONSTRUCTOR is shadowed here to create a Java5Constructor
50-
return IterUtil.mapSnapshot(IterUtil.make(_c.getDeclaredConstructors()), CONVERT_CONSTRUCTOR);
50+
return IterUtil.mapSnapshot(IterUtil.asIterable(_c.getDeclaredConstructors()), CONVERT_CONSTRUCTOR);
5151
}
5252

5353
public Iterable<DJMethod> declaredMethods() {
5454
// CONVERT_METHOD is shadowed here to create a Java5Method
55-
Iterable<Method> ms = IterUtil.filter(IterUtil.make(_c.getDeclaredMethods()), IS_NOT_BRIDGE);
55+
Iterable<Method> ms = IterUtil.filter(IterUtil.asIterable(_c.getDeclaredMethods()), IS_NOT_BRIDGE);
5656
return IterUtil.mapSnapshot(ms, CONVERT_METHOD);
5757
}
5858

5959
private static final Predicate<Method> IS_NOT_BRIDGE = new Predicate<Method>() {
60-
public Boolean value(Method m) { return !m.isBridge(); }
60+
public boolean contains(Method m) { return !m.isBridge(); }
6161
};
6262

6363
public Iterable<DJClass> declaredClasses() {
6464
// CONVERT_CLASS is shadowed here to create a Java5Class
65-
return IterUtil.mapSnapshot(IterUtil.make(_c.getDeclaredClasses()), CONVERT_CLASS);
65+
return IterUtil.mapSnapshot(IterUtil.asIterable(_c.getDeclaredClasses()), CONVERT_CLASS);
6666
}
6767

6868

@@ -262,10 +262,10 @@ private static class Java5Field extends JavaField {
262262
private class Java5Constructor extends JavaConstructor {
263263
public Java5Constructor(Constructor k) { super(k); }
264264
public Iterable<VariableType> declaredTypeParameters() {
265-
return IterUtil.mapSnapshot(IterUtil.make(_k.getTypeParameters()), CONVERT_VAR);
265+
return IterUtil.mapSnapshot(IterUtil.asIterable(_k.getTypeParameters()), CONVERT_VAR);
266266
}
267267
public Iterable<Type> thrownTypes() {
268-
return IterUtil.mapSnapshot(IterUtil.make(_k.getGenericExceptionTypes()), CONVERT_TYPE);
268+
return IterUtil.mapSnapshot(IterUtil.asIterable(_k.getGenericExceptionTypes()), CONVERT_TYPE);
269269
}
270270
protected Thunk<Iterable<LocalVariable>> makeParamThunk() {
271271
return paramFactory(_k.getGenericParameterTypes(), _k.isVarArgs());
@@ -276,10 +276,10 @@ private static class Java5Method extends JavaMethod {
276276
public Java5Method(Method m) { super(m); }
277277
public Type returnType() { return CONVERT_TYPE.value(_m.getGenericReturnType()); }
278278
public Iterable<VariableType> declaredTypeParameters() {
279-
return IterUtil.mapSnapshot(IterUtil.make(_m.getTypeParameters()), CONVERT_VAR);
279+
return IterUtil.mapSnapshot(IterUtil.asIterable(_m.getTypeParameters()), CONVERT_VAR);
280280
}
281281
public Iterable<Type> thrownTypes() {
282-
return IterUtil.mapSnapshot(IterUtil.make(_m.getGenericExceptionTypes()), CONVERT_TYPE);
282+
return IterUtil.mapSnapshot(IterUtil.asIterable(_m.getGenericExceptionTypes()), CONVERT_TYPE);
283283
}
284284
protected Thunk<Iterable<LocalVariable>> makeParamThunk() {
285285
return paramFactory(_m.getGenericParameterTypes(), _m.isVarArgs());

0 commit comments

Comments
 (0)