Skip to content

Commit 57c329e

Browse files
author
rcartwright
committed
Cleaned up the generic typing of various files; only the four unavoidable warnings caused by type erasure remain.
git-svn-id: file:///tmp/test-svn/trunk@2913 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent 46bddad commit 57c329e

31 files changed

Lines changed: 171 additions & 177 deletions

dynamicjava/src/koala/Version.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
* This file is copied to Version.java by the build process, which also
5454
* fills in the right values of the date and time.
5555
*
56-
* This javadoc corresponds to build drjava-20050302-1708;
56+
* This javadoc corresponds to build drjava-20050312-1436;
5757
*
5858
* @version $Id$
5959
*/
@@ -62,7 +62,7 @@ public abstract class Version {
6262
* This string will be automatically expanded upon "ant commit".
6363
* Do not edit it by hand!
6464
*/
65-
private static final String BUILD_TIME_STRING = "20050302-1708";
65+
private static final String BUILD_TIME_STRING = "20050312-1436";
6666

6767
/** A {@link Date} version of the build time. */
6868
private static final Date BUILD_TIME = _getBuildDate();

dynamicjava/src/koala/dynamicjava/classfile/JVMUtilities.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public abstract class JVMUtilities {
119119
/**
120120
* Returns the string that represents internally the given class
121121
*/
122-
public static String getName(Class c) {
122+
public static String getName(Class<?> c) {
123123
String s = types.get(c);
124124
if (s != null) {
125125
return s;
@@ -151,7 +151,7 @@ public static String getName(String c) {
151151
/**
152152
* Returns the string that represents internally the given class
153153
*/
154-
public static String getReturnTypeName(Class c) {
154+
public static String getReturnTypeName(Class<?> c) {
155155
String s = types.get(c);
156156
if (s != null) {
157157
return s;
@@ -181,7 +181,7 @@ public static String getReturnTypeName(String c) {
181181
/**
182182
* Returns the string that represents internally the given class
183183
*/
184-
public static String getParameterTypeName(Class c) {
184+
public static String getParameterTypeName(Class<?> c) {
185185
return getReturnTypeName(c);
186186
}
187187

dynamicjava/src/koala/dynamicjava/classinfo/ClassInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public interface ClassInfo {
4242
/**
4343
* Returns the underlying class
4444
*/
45-
Class getJavaClass();
45+
Class<?> getJavaClass();
4646

4747
/**
4848
* Whether the underlying class needs compilation

dynamicjava/src/koala/dynamicjava/classinfo/ClassInfoUtilities.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ public static boolean isAssignableFrom(ClassInfo c1, ClassInfo c2) {
8888
if (c2 == null || !c2.isPrimitive()) {
8989
return false;
9090
} else {
91-
Class cl1 = c1.getJavaClass();
92-
Class cl2 = c2.getJavaClass();
91+
Class<?> cl1 = c1.getJavaClass();
92+
Class<?> cl2 = c2.getJavaClass();
9393
if (cl1 == short.class) {
9494
return cl2 == byte.class;
9595
} else if (cl1 == int.class) {

dynamicjava/src/koala/dynamicjava/classinfo/JavaClassInfo.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ public class JavaClassInfo implements ClassInfo {
7979
/**
8080
* The underlying class
8181
*/
82-
private Class javaClass;
82+
private Class<?> javaClass;
8383

8484
/**
8585
* Creates a new class info
8686
* @param c the java class
8787
*/
88-
public JavaClassInfo(Class c) {
88+
public JavaClassInfo(Class<?> c) {
8989
if (c == null) throw new IllegalArgumentException("c == null");
9090

9191
javaClass = c;
@@ -102,16 +102,12 @@ public JavaClassInfo(JavaClassInfo c) {
102102
/**
103103
* Returns the underlying class
104104
*/
105-
public Class getJavaClass() {
106-
return javaClass;
107-
}
105+
public Class<?> getJavaClass() { return javaClass; }
108106

109107
/**
110108
* Whether the underlying class needs compilation
111109
*/
112-
public boolean isCompilable() {
113-
return false;
114-
}
110+
public boolean isCompilable() { return false; }
115111

116112
/**
117113
* Sets the compilable property
@@ -124,7 +120,7 @@ public void setCompilable(boolean b) {
124120
* Returns the declaring class or null
125121
*/
126122
public ClassInfo getDeclaringClass() {
127-
Class c = javaClass.getDeclaringClass();
123+
Class<?> c = javaClass.getDeclaringClass();
128124
return (c == null) ? null : new JavaClassInfo(c);
129125
}
130126

@@ -154,7 +150,7 @@ public String getName() {
154150
* represented by this info
155151
*/
156152
public ClassInfo getSuperclass() {
157-
Class c = javaClass.getSuperclass();
153+
Class<?> c = javaClass.getSuperclass();
158154
return (c == null) ? null : new JavaClassInfo(c);
159155
}
160156

@@ -163,7 +159,7 @@ public ClassInfo getSuperclass() {
163159
* the class this info represents
164160
*/
165161
public ClassInfo[] getInterfaces() {
166-
Class[] interfaces = javaClass.getInterfaces();
162+
Class<?>[] interfaces = javaClass.getInterfaces();
167163
ClassInfo[] result = new ClassInfo[interfaces.length];
168164

169165
for (int i = 0; i < interfaces.length; i++) {
@@ -216,7 +212,7 @@ public MethodInfo[] getMethods() {
216212
* of the class represented by this ClassInfo object.
217213
*/
218214
public ClassInfo[] getDeclaredClasses() {
219-
Class[] classes = javaClass.getDeclaredClasses();
215+
Class<?>[] classes = javaClass.getDeclaredClasses();
220216
ClassInfo[] result = new ClassInfo[classes.length];
221217

222218
for (int i = 0; i < classes.length; i++) {

dynamicjava/src/koala/dynamicjava/classinfo/JavaConstructorInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public int getModifiers() {
6767
* by this object
6868
*/
6969
public ClassInfo[] getParameterTypes() {
70-
Class[] pcs = javaConstructor.getParameterTypes();
70+
Class<?>[] pcs = javaConstructor.getParameterTypes();
7171
ClassInfo[] result = new ClassInfo[pcs.length];
7272

7373
for (int i = 0; i < pcs.length; i++) {
@@ -81,7 +81,7 @@ public ClassInfo[] getParameterTypes() {
8181
* the exceptions declared to be thrown by the underlying constructor
8282
*/
8383
public ClassInfo[] getExceptionTypes() {
84-
Class[] ecs = javaConstructor.getExceptionTypes();
84+
Class<?>[] ecs = javaConstructor.getExceptionTypes();
8585
ClassInfo[] result = new ClassInfo[ecs.length];
8686

8787
for (int i = 0; i < ecs.length; i++) {

dynamicjava/src/koala/dynamicjava/classinfo/JavaMethodInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public String getName() {
9191
*/
9292
public ClassInfo[] getParameterTypes() {
9393
if (parameters == null) {
94-
Class[] pcs = javaMethod.getParameterTypes();
94+
Class<?>[] pcs = javaMethod.getParameterTypes();
9595
parameters = new ClassInfo[pcs.length];
9696

9797
for (int i = 0; i < pcs.length; i++) {
@@ -107,7 +107,7 @@ public ClassInfo[] getParameterTypes() {
107107
*/
108108
public ClassInfo[] getExceptionTypes() {
109109
if (exceptions == null) {
110-
Class[] ecs = javaMethod.getExceptionTypes();
110+
Class<?>[] ecs = javaMethod.getExceptionTypes();
111111
exceptions = new ClassInfo[ecs.length];
112112

113113
for (int i = 0; i < ecs.length; i++) {

dynamicjava/src/koala/dynamicjava/classinfo/TreeClassInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public TreeClassInfo(TreeClassInfo ci) {
162162
/**
163163
* Returns the underlying class
164164
*/
165-
public Class getJavaClass() {
165+
public Class<?> getJavaClass() {
166166
throw new IllegalStateException();
167167
}
168168

dynamicjava/src/koala/dynamicjava/interpreter/AbstractTypeChecker.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
*
9595
*/
9696

97-
public abstract class AbstractTypeChecker extends VisitorObject<Class> {
97+
public abstract class AbstractTypeChecker extends VisitorObject<Class<?>> {
9898
/**
9999
* The context
100100
*/
@@ -288,7 +288,7 @@ public Class<?> visit(SwitchStatement node) {
288288
if (lc != char.class && lc != byte.class &&
289289
lc != short.class && lc != int.class &&
290290
// (TigerUtilities.isTigerEnabled() && (lc.getSuperclass() != Class.forName("java.lang.Enum")))) {
291-
!TigerUtilities.isEnum(lc)) {
291+
(TigerUtilities.isTigerEnabled() && !TigerUtilities.isEnum(lc))) {
292292
node.setProperty(NodeProperties.ERROR_STRINGS,
293293
new String[] { lc.getName() });
294294
throw new ExecutionError("switch.label.type", node);
@@ -607,16 +607,15 @@ public Class<?> visit(ObjectFieldAccess node) {
607607
Field f = null;
608608
try {
609609
f = context.getField(c, node.getFieldName());
610-
} catch (Exception e) {
611-
throw new CatchedExceptionError(e, node);
612-
}
610+
} catch (Exception e) { throw new CatchedExceptionError(e, node); }
613611

614612
// Set the node properties
613+
c = f.getType();
615614
node.setProperty(NodeProperties.FIELD, f);
616-
node.setProperty(NodeProperties.TYPE, c = f.getType());
617-
615+
node.setProperty(NodeProperties.TYPE, c);
618616
node.setProperty(NodeProperties.MODIFIER, context.getModifier(node));
619617
return c;
618+
620619
} else {
621620
if (!node.getFieldName().equals("length")) {
622621
String s0 = "length";
@@ -687,7 +686,7 @@ public Class<?> visit(ObjectMethodCall node) {
687686
if (!c.isArray() || (c.isArray() && !mn.equals("clone"))) {
688687
// Do the type checking of the arguments
689688
List<Expression> args = node.getArguments();
690-
Class[] cargs = Constants.EMPTY_CLASS_ARRAY;
689+
Class<?>[] cargs = Constants.EMPTY_CLASS_ARRAY;
691690
if (args != null) {
692691
cargs = new Class[args.size()];
693692
Iterator<Expression> it = args.iterator();
@@ -772,7 +771,7 @@ public Class<?> visit(MethodDeclaration node) {
772771
public Class<?> visit(FunctionCall node) {
773772
// Do the type checking of the arguments
774773
List<Expression> args = node.getArguments();
775-
Class[] cargs = Constants.EMPTY_CLASS_ARRAY;
774+
Class<?>[] cargs = Constants.EMPTY_CLASS_ARRAY;
776775
if (args != null) {
777776
cargs = new Class[args.size()];
778777
Iterator<Expression> it = args.iterator();
@@ -804,7 +803,7 @@ public Class<?> visit(FunctionCall node) {
804803
public Class<?> visit(SuperMethodCall node) {
805804
// Do the type checking of the arguments
806805
List<Expression> args = node.getArguments();
807-
Class[] pt = Constants.EMPTY_CLASS_ARRAY;
806+
Class<?>[] pt = Constants.EMPTY_CLASS_ARRAY;
808807
if (args != null) {
809808
pt = new Class[args.size()];
810809
Iterator<Expression> it = args.iterator();
@@ -834,7 +833,7 @@ public Class<?> visit(SuperMethodCall node) {
834833
public Class<?> visit(StaticMethodCall node) {
835834
// Do the type checking of the arguments
836835
List<Expression> args = node.getArguments();
837-
Class[] cargs = Constants.EMPTY_CLASS_ARRAY;
836+
Class<?>[] cargs = Constants.EMPTY_CLASS_ARRAY;
838837
if (args != null) {
839838
cargs = new Class[args.size()];
840839
Iterator<Expression> it = args.iterator();
@@ -1012,7 +1011,7 @@ public Class<?> visit(ClassAllocation node) {
10121011
Node ctn = node.getCreationType();
10131012
Class<?> ct = ctn.acceptVisitor(this);
10141013
List<Expression> largs = node.getArguments();
1015-
Class[] args = Constants.EMPTY_CLASS_ARRAY;
1014+
Class<?>[] args = Constants.EMPTY_CLASS_ARRAY;
10161015

10171016
if (largs != null) {
10181017
args = new Class[largs.size()];
@@ -2845,7 +2844,7 @@ else if (!ec.isAssignableFrom(tc) && !tc.isAssignableFrom(ec)) {
28452844
/**
28462845
* Tests if the class/interface c is final
28472846
*/
2848-
private static boolean isFinal(Class c) {
2847+
private static boolean isFinal(Class<?> c) {
28492848
return Modifier.isFinal(c.getModifiers());
28502849
}
28512850

dynamicjava/src/koala/dynamicjava/interpreter/ClassFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ public class ClassFactory extends ClassFile {
312312
public ClassFactory(int af,
313313
String name,
314314
String sname,
315-
Class interp,
316-
Class except,
315+
Class<?> interp,
316+
Class<?> except,
317317
String clid) {
318318
super(name, sname);
319319
this.name = name;

0 commit comments

Comments
 (0)