ART: Fix type parameter in tests
Move Class to Class<?>, Constructor to Constructor<?>, and in
general clean up reflection.
Test: m test-art-host-run-test
Change-Id: I3a4223ee8d14d032015edf34bf27135757f7138c
diff --git a/test/004-JniTest/src/Main.java b/test/004-JniTest/src/Main.java
index e0530d8..0221900 100644
--- a/test/004-JniTest/src/Main.java
+++ b/test/004-JniTest/src/Main.java
@@ -220,7 +220,7 @@
InvocationHandler handler = new DummyInvocationHandler();
SimpleInterface proxy =
(SimpleInterface) Proxy.newProxyInstance(SimpleInterface.class.getClassLoader(),
- new Class[] {SimpleInterface.class}, handler);
+ new Class<?>[] {SimpleInterface.class}, handler);
if (testGetMethodID(SimpleInterface.class) == 0) {
throw new AssertionError();
}
diff --git a/test/004-UnsafeTest/src/Main.java b/test/004-UnsafeTest/src/Main.java
index 9d4618a..d43d374 100644
--- a/test/004-UnsafeTest/src/Main.java
+++ b/test/004-UnsafeTest/src/Main.java
@@ -249,6 +249,6 @@
public volatile Object volatileObjectVar = null;
}
- private static native int vmArrayBaseOffset(Class clazz);
- private static native int vmArrayIndexScale(Class clazz);
+ private static native int vmArrayBaseOffset(Class<?> clazz);
+ private static native int vmArrayIndexScale(Class<?> clazz);
}
diff --git a/test/005-annotations/src/android/test/anno/AnnoFancyMethod.java b/test/005-annotations/src/android/test/anno/AnnoFancyMethod.java
index 3088866..aa7808f 100644
--- a/test/005-annotations/src/android/test/anno/AnnoFancyMethod.java
+++ b/test/005-annotations/src/android/test/anno/AnnoFancyMethod.java
@@ -10,5 +10,5 @@
boolean callMe() default false;
boolean biteMe();
AnnoFancyMethodEnum enumerated() default AnnoFancyMethodEnum.FOO;
- Class someClass() default SomeClass.class;
+ Class<?> someClass() default SomeClass.class;
}
diff --git a/test/005-annotations/src/android/test/anno/AnnoMissingClass.java b/test/005-annotations/src/android/test/anno/AnnoMissingClass.java
index c32e9a2..7933b80 100644
--- a/test/005-annotations/src/android/test/anno/AnnoMissingClass.java
+++ b/test/005-annotations/src/android/test/anno/AnnoMissingClass.java
@@ -20,5 +20,5 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface AnnoMissingClass {
- Class value();
+ Class<?> value();
}
diff --git a/test/005-annotations/src/android/test/anno/TestAnnotations.java b/test/005-annotations/src/android/test/anno/TestAnnotations.java
index 51254b4..8ea8e8e 100644
--- a/test/005-annotations/src/android/test/anno/TestAnnotations.java
+++ b/test/005-annotations/src/android/test/anno/TestAnnotations.java
@@ -42,7 +42,7 @@
}
}
- static void printAnnotations(Class clazz) {
+ static void printAnnotations(Class<?> clazz) {
Annotation[] annos;
Annotation[][] parAnnos;
@@ -52,7 +52,7 @@
printAnnotationArray("", annos);
System.out.println();
- for (Constructor c: clazz.getDeclaredConstructors()) {
+ for (Constructor<?> c: clazz.getDeclaredConstructors()) {
annos = c.getDeclaredAnnotations();
System.out.println(" annotations on CTOR " + c + ":");
printAnnotationArray(" ", annos);
@@ -139,8 +139,7 @@
final IntToString[] mapping;
try {
- meth = TestAnnotations.class.getMethod("getFocusType",
- (Class[])null);
+ meth = TestAnnotations.class.getMethod("getFocusType");
} catch (NoSuchMethodException nsme) {
throw new RuntimeException(nsme);
}
@@ -255,7 +254,7 @@
}
private static class VMRuntime {
- private static Class vmRuntimeClass;
+ private static Class<?> vmRuntimeClass;
private static Method getRuntimeMethod;
private static Method getTargetSdkVersionMethod;
private static Method setTargetSdkVersionMethod;
diff --git a/test/021-string2/src/Main.java b/test/021-string2/src/Main.java
index 0226614..d1ea0b1 100644
--- a/test/021-string2/src/Main.java
+++ b/test/021-string2/src/Main.java
@@ -85,7 +85,7 @@
Assert.assertEquals("this is a path", test.replaceAll("/", " "));
Assert.assertEquals("this is a path", test.replace("/", " "));
- Class Strings = Class.forName("com.android.org.bouncycastle.util.Strings");
+ Class<?> Strings = Class.forName("com.android.org.bouncycastle.util.Strings");
Method fromUTF8ByteArray = Strings.getDeclaredMethod("fromUTF8ByteArray", byte[].class);
String result = (String) fromUTF8ByteArray.invoke(null, new byte[] {'O', 'K'});
System.out.println(result);
diff --git a/test/031-class-attributes/src/ClassAttrs.java b/test/031-class-attributes/src/ClassAttrs.java
index 38bd525..346e13d 100644
--- a/test/031-class-attributes/src/ClassAttrs.java
+++ b/test/031-class-attributes/src/ClassAttrs.java
@@ -118,14 +118,13 @@
printClassAttrs(FancyClass.class);
try {
- Constructor cons;
- cons = MemberClass.class.getConstructor(
- new Class[] { MemberClass.class });
+ Constructor<?> cons;
+ cons = MemberClass.class.getConstructor(MemberClass.class);
System.out.println("constructor signature: "
+ getSignatureAttribute(cons));
Method meth;
- meth = MemberClass.class.getMethod("foo", (Class[]) null);
+ meth = MemberClass.class.getMethod("foo");
System.out.println("method signature: "
+ getSignatureAttribute(meth));
@@ -222,7 +221,7 @@
public static String getSignatureAttribute(Object obj) {
Method method;
try {
- Class c = obj.getClass();
+ Class<?> c = obj.getClass();
if (c == Method.class || c == Constructor.class) {
c = AbstractMethod.class;
}
@@ -263,9 +262,7 @@
/*
* Dump a variety of class attributes.
*/
- public static void printClassAttrs(Class clazz) {
- Class clazz2;
-
+ public static <T> void printClassAttrs(Class<T> clazz) {
System.out.println("***** " + clazz + ":");
System.out.println(" name: "
@@ -321,7 +318,7 @@
System.out.println(" genericInterfaces: "
+ stringifyTypeArray(clazz.getGenericInterfaces()));
- TypeVariable<Class<?>>[] typeParameters = clazz.getTypeParameters();
+ TypeVariable<Class<T>>[] typeParameters = clazz.getTypeParameters();
System.out.println(" typeParameters: "
+ stringifyTypeArray(typeParameters));
}
diff --git a/test/032-concrete-sub/src/ConcreteSub.java b/test/032-concrete-sub/src/ConcreteSub.java
index 083f25d..95adf63 100644
--- a/test/032-concrete-sub/src/ConcreteSub.java
+++ b/test/032-concrete-sub/src/ConcreteSub.java
@@ -37,13 +37,13 @@
/*
* Check reflection stuff.
*/
- Class absClass = AbstractBase.class;
+ Class<?> absClass = AbstractBase.class;
Method meth;
System.out.println("class modifiers=" + absClass.getModifiers());
try {
- meth = absClass.getMethod("redefineMe", (Class[]) null);
+ meth = absClass.getMethod("redefineMe");
} catch (NoSuchMethodException nsme) {
nsme.printStackTrace();
return;
diff --git a/test/042-new-instance/src/Main.java b/test/042-new-instance/src/Main.java
index 8cd6b2e..755d62e 100644
--- a/test/042-new-instance/src/Main.java
+++ b/test/042-new-instance/src/Main.java
@@ -33,7 +33,7 @@
static void testClassNewInstance() {
// should succeed
try {
- Class c = Class.forName("LocalClass");
+ Class<?> c = Class.forName("LocalClass");
Object obj = c.newInstance();
System.out.println("LocalClass succeeded");
} catch (Exception ex) {
@@ -43,7 +43,7 @@
// should fail
try {
- Class c = Class.forName("otherpackage.PackageAccess");
+ Class<?> c = Class.forName("otherpackage.PackageAccess");
Object obj = c.newInstance();
System.err.println("ERROR: PackageAccess succeeded unexpectedly");
} catch (IllegalAccessException iae) {
@@ -71,8 +71,8 @@
static void testConstructorNewInstance() {
// should fail -- getConstructor only returns public constructors
try {
- Class c = Class.forName("LocalClass");
- Constructor cons = c.getConstructor(new Class[0] /*(Class[])null*/);
+ Class<?> c = Class.forName("LocalClass");
+ Constructor<?> cons = c.getConstructor();
System.err.println("Cons LocalClass succeeded unexpectedly");
} catch (NoSuchMethodException nsme) {
System.out.println("Cons LocalClass failed as expected");
@@ -83,8 +83,8 @@
// should succeed
try {
- Class c = Class.forName("LocalClass2");
- Constructor cons = c.getConstructor((Class[]) null);
+ Class<?> c = Class.forName("LocalClass2");
+ Constructor<?> cons = c.getConstructor();
Object obj = cons.newInstance();
System.out.println("Cons LocalClass2 succeeded");
} catch (Exception ex) {
@@ -94,8 +94,8 @@
// should succeed
try {
- Class c = Class.forName("Main$InnerClass");
- Constructor cons = c.getDeclaredConstructor(new Class<?>[]{Main.class});
+ Class<?> c = Class.forName("Main$InnerClass");
+ Constructor<?> cons = c.getDeclaredConstructor(Main.class);
Object obj = cons.newInstance(new Main());
System.out.println("Cons InnerClass succeeded");
} catch (Exception ex) {
@@ -105,8 +105,8 @@
// should succeed
try {
- Class c = Class.forName("Main$StaticInnerClass");
- Constructor cons = c.getDeclaredConstructor((Class[]) null);
+ Class<?> c = Class.forName("Main$StaticInnerClass");
+ Constructor<?> cons = c.getDeclaredConstructor();
Object obj = cons.newInstance();
System.out.println("Cons StaticInnerClass succeeded");
} catch (Exception ex) {
@@ -116,8 +116,8 @@
// should fail
try {
- Class c = Class.forName("otherpackage.PackageAccess");
- Constructor cons = c.getConstructor(new Class[0] /*(Class[])null*/);
+ Class<?> c = Class.forName("otherpackage.PackageAccess");
+ Constructor<?> cons = c.getConstructor();
System.err.println("ERROR: Cons PackageAccess succeeded unexpectedly");
} catch (NoSuchMethodException nsme) {
// constructor isn't public
@@ -129,8 +129,8 @@
// should fail
try {
- Class c = Class.forName("MaybeAbstract");
- Constructor cons = c.getConstructor(new Class[0] /*(Class[])null*/);
+ Class<?> c = Class.forName("MaybeAbstract");
+ Constructor<?> cons = c.getConstructor();
Object obj = cons.newInstance();
System.err.println("ERROR: Cons MaybeAbstract succeeded unexpectedly");
} catch (InstantiationException ie) {
@@ -143,8 +143,8 @@
// should fail
try {
- Class c = Class.forName("otherpackage.PackageAccess2");
- Constructor cons = c.getConstructor((Class[]) null);
+ Class<?> c = Class.forName("otherpackage.PackageAccess2");
+ Constructor<?> cons = c.getConstructor();
if (!FULL_ACCESS_CHECKS) { throw new IllegalAccessException(); }
Object obj = cons.newInstance();
System.err.println("ERROR: Cons PackageAccess2 succeeded unexpectedly");
@@ -197,7 +197,7 @@
static Object newInstance() {
try {
- Class c = CC.class;
+ Class<?> c = CC.class;
return c.newInstance();
} catch (Exception ex) {
ex.printStackTrace();
diff --git a/test/042-new-instance/src/otherpackage/ConstructorAccess.java b/test/042-new-instance/src/otherpackage/ConstructorAccess.java
index a74e9a0..79d572c 100644
--- a/test/042-new-instance/src/otherpackage/ConstructorAccess.java
+++ b/test/042-new-instance/src/otherpackage/ConstructorAccess.java
@@ -29,8 +29,8 @@
// accessibility using the frame below (in Main class), we will see an
// IllegalAccessException from #newInstance
static public void newConstructorInstance() throws Exception {
- Class c = Inner.class;
- Constructor cons = c.getDeclaredConstructor((Class[]) null);
+ Class<?> c = Inner.class;
+ Constructor cons = c.getDeclaredConstructor();
Object obj = cons.newInstance();
}
}
diff --git a/test/044-proxy/src/BasicTest.java b/test/044-proxy/src/BasicTest.java
index 445a6cc..5f04b93 100644
--- a/test/044-proxy/src/BasicTest.java
+++ b/test/044-proxy/src/BasicTest.java
@@ -99,18 +99,16 @@
InvocationHandler handler = new MyInvocationHandler(proxyMe);
/* create the proxy class */
- Class proxyClass = Proxy.getProxyClass(Shapes.class.getClassLoader(),
- new Class[] { Quads.class, Colors.class, Trace.class });
+ Class<?> proxyClass = Proxy.getProxyClass(Shapes.class.getClassLoader(),
+ Quads.class, Colors.class, Trace.class);
Main.registerProxyClassName(proxyClass.getCanonicalName());
/* create a proxy object, passing the handler object in */
Object proxy = null;
try {
- Constructor<Class> cons;
- cons = proxyClass.getConstructor(
- new Class[] { InvocationHandler.class });
+ Constructor<?> cons = proxyClass.getConstructor(InvocationHandler.class);
//System.out.println("Constructor is " + cons);
- proxy = cons.newInstance(new Object[] { handler });
+ proxy = cons.newInstance(handler);
} catch (NoSuchMethodException nsme) {
System.err.println("failed: " + nsme);
} catch (InstantiationException ie) {
diff --git a/test/044-proxy/src/Clash.java b/test/044-proxy/src/Clash.java
index adeffdc..d000112 100644
--- a/test/044-proxy/src/Clash.java
+++ b/test/044-proxy/src/Clash.java
@@ -30,7 +30,7 @@
/* try passing in the same interface twice */
try {
Proxy.newProxyInstance(Clash.class.getClassLoader(),
- new Class[] { Interface1A.class, Interface1A.class },
+ new Class<?>[] { Interface1A.class, Interface1A.class },
handler);
System.err.println("Dupe did not throw expected exception");
} catch (IllegalArgumentException iae) {
@@ -39,7 +39,7 @@
try {
Proxy.newProxyInstance(Clash.class.getClassLoader(),
- new Class[] { Interface1A.class, Interface1B.class },
+ new Class<?>[] { Interface1A.class, Interface1B.class },
handler);
System.err.println("Clash did not throw expected exception");
} catch (IllegalArgumentException iae) {
diff --git a/test/044-proxy/src/Clash2.java b/test/044-proxy/src/Clash2.java
index 2a384f4..e405cfe 100644
--- a/test/044-proxy/src/Clash2.java
+++ b/test/044-proxy/src/Clash2.java
@@ -29,7 +29,7 @@
try {
Proxy.newProxyInstance(Clash.class.getClassLoader(),
- new Class[] { Interface2A.class, Interface2B.class },
+ new Class<?>[] { Interface2A.class, Interface2B.class },
handler);
System.err.println("Clash2 did not throw expected exception");
} catch (IllegalArgumentException iae) {
diff --git a/test/044-proxy/src/Clash3.java b/test/044-proxy/src/Clash3.java
index 6d6f2f2..44806ce 100644
--- a/test/044-proxy/src/Clash3.java
+++ b/test/044-proxy/src/Clash3.java
@@ -29,7 +29,7 @@
try {
Proxy.newProxyInstance(Clash.class.getClassLoader(),
- new Class[] {
+ new Class<?>[] {
Interface3a.class,
Interface3base.class,
Interface3aa.class,
diff --git a/test/044-proxy/src/Clash4.java b/test/044-proxy/src/Clash4.java
index 1bfb37f..ca5c3ab 100644
--- a/test/044-proxy/src/Clash4.java
+++ b/test/044-proxy/src/Clash4.java
@@ -29,7 +29,7 @@
try {
Proxy.newProxyInstance(Clash.class.getClassLoader(),
- new Class[] {
+ new Class<?>[] {
Interface4a.class,
Interface4aa.class,
Interface4base.class,
diff --git a/test/044-proxy/src/FloatSelect.java b/test/044-proxy/src/FloatSelect.java
index febe697..217ccaf 100644
--- a/test/044-proxy/src/FloatSelect.java
+++ b/test/044-proxy/src/FloatSelect.java
@@ -34,7 +34,7 @@
public static void main(String[] args) {
FloatSelectI proxyObject = (FloatSelectI) Proxy.newProxyInstance(
FloatSelectI.class.getClassLoader(),
- new Class[] { FloatSelectI.class },
+ new Class<?>[] { FloatSelectI.class },
new FloatSelectIInvoke1());
float floatResult = proxyObject.method(2.1f, 5.8f);
diff --git a/test/044-proxy/src/NativeProxy.java b/test/044-proxy/src/NativeProxy.java
index b425da8..c609dc2 100644
--- a/test/044-proxy/src/NativeProxy.java
+++ b/test/044-proxy/src/NativeProxy.java
@@ -40,7 +40,7 @@
try {
NativeInterface inf = (NativeInterface)Proxy.newProxyInstance(
NativeProxy.class.getClassLoader(),
- new Class[] { NativeInterface.class },
+ new Class<?>[] { NativeInterface.class },
new NativeInvocationHandler());
nativeCall(inf);
diff --git a/test/044-proxy/src/ReturnsAndArgPassing.java b/test/044-proxy/src/ReturnsAndArgPassing.java
index 225cc5b..3d8ebf0 100644
--- a/test/044-proxy/src/ReturnsAndArgPassing.java
+++ b/test/044-proxy/src/ReturnsAndArgPassing.java
@@ -98,7 +98,7 @@
MyInvocationHandler myHandler = new MyInvocationHandler();
MyInterface proxyMyInterface =
(MyInterface)Proxy.newProxyInstance(ReturnsAndArgPassing.class.getClassLoader(),
- new Class[] { MyInterface.class },
+ new Class<?>[] { MyInterface.class },
myHandler);
check(fooInvocations == 0);
proxyMyInterface.voidFoo();
@@ -441,7 +441,7 @@
MyInvocationHandler myHandler = new MyInvocationHandler();
MyInterface proxyMyInterface =
(MyInterface)Proxy.newProxyInstance(ReturnsAndArgPassing.class.getClassLoader(),
- new Class[] { MyInterface.class },
+ new Class<?>[] { MyInterface.class },
myHandler);
check((Integer)proxyMyInterface.selectArg(0, Integer.MAX_VALUE, Long.MAX_VALUE,
diff --git a/test/044-proxy/src/WrappedThrow.java b/test/044-proxy/src/WrappedThrow.java
index 27ae84e..643ba05 100644
--- a/test/044-proxy/src/WrappedThrow.java
+++ b/test/044-proxy/src/WrappedThrow.java
@@ -32,7 +32,7 @@
try {
proxy = Proxy.newProxyInstance(WrappedThrow.class.getClassLoader(),
- new Class[] { InterfaceW1.class, InterfaceW2.class },
+ new Class<?>[] { InterfaceW1.class, InterfaceW2.class },
handler);
} catch (IllegalArgumentException iae) {
System.out.println("WT init failed");
diff --git a/test/046-reflect/src/Main.java b/test/046-reflect/src/Main.java
index 67a0d11..10dad8d 100644
--- a/test/046-reflect/src/Main.java
+++ b/test/046-reflect/src/Main.java
@@ -32,7 +32,7 @@
public Main(ArrayList<Integer> stuff) {}
void printMethodInfo(Method meth) {
- Class[] params, exceptions;
+ Class<?>[] params, exceptions;
int i;
System.out.println("Method name is " + meth.getName());
@@ -62,7 +62,7 @@
private void showStrings(Target instance)
throws NoSuchFieldException, IllegalAccessException {
- Class target = Target.class;
+ Class<?> target = Target.class;
String one, two, three, four;
Field field = null;
@@ -80,15 +80,15 @@
public static void checkAccess() {
try {
- Class target = otherpackage.Other.class;
+ Class<?> target = otherpackage.Other.class;
Object instance = new otherpackage.Other();
Method meth;
- meth = target.getMethod("publicMethod", (Class[]) null);
+ meth = target.getMethod("publicMethod");
meth.invoke(instance);
try {
- meth = target.getMethod("packageMethod", (Class[]) null);
+ meth = target.getMethod("packageMethod");
System.err.println("succeeded on package-scope method");
} catch (NoSuchMethodException nsme) {
// good
@@ -97,7 +97,7 @@
instance = otherpackage.Other.getInnerClassInstance();
target = instance.getClass();
- meth = target.getMethod("innerMethod", (Class[]) null);
+ meth = target.getMethod("innerMethod");
try {
if (!FULL_ACCESS_CHECKS) { throw new IllegalAccessException(); }
meth.invoke(instance);
@@ -121,26 +121,25 @@
}
public void run() {
- Class target = Target.class;
+ Class<Target> target = Target.class;
Method meth = null;
Field field = null;
boolean excep;
try {
- meth = target.getMethod("myMethod", new Class[] { int.class });
+ meth = target.getMethod("myMethod", int.class);
if (meth.getDeclaringClass() != target)
throw new RuntimeException();
printMethodInfo(meth);
- meth = target.getMethod("myMethod", new Class[] { float.class });
+ meth = target.getMethod("myMethod", float.class);
printMethodInfo(meth);
- meth = target.getMethod("myNoargMethod", (Class[]) null);
+ meth = target.getMethod("myNoargMethod");
printMethodInfo(meth);
- meth = target.getMethod("myMethod",
- new Class[] { String[].class, float.class, char.class });
+ meth = target.getMethod("myMethod", String[].class, float.class, char.class);
printMethodInfo(meth);
Target instance = new Target();
@@ -157,11 +156,11 @@
System.out.println("Result of invoke: " + boxval.intValue());
System.out.println("Calling no-arg void-return method");
- meth = target.getMethod("myNoargMethod", (Class[]) null);
+ meth = target.getMethod("myNoargMethod");
meth.invoke(instance, (Object[]) null);
/* try invoking a method that throws an exception */
- meth = target.getMethod("throwingMethod", (Class[]) null);
+ meth = target.getMethod("throwingMethod");
try {
meth.invoke(instance, (Object[]) null);
System.out.println("GLITCH: didn't throw");
@@ -372,7 +371,7 @@
Target targ;
Object[] args;
- cons = target.getConstructor(new Class[] { int.class,float.class });
+ cons = target.getConstructor(int.class, float.class);
args = new Object[] { new Integer(7), new Float(3.3333) };
System.out.println("cons modifiers=" + cons.getModifiers());
targ = cons.newInstance(args);
@@ -458,7 +457,7 @@
public static void checkClinitForFields() throws Exception {
// Loading a class constant shouldn't run <clinit>.
System.out.println("calling const-class FieldNoisyInitUser.class");
- Class niuClass = FieldNoisyInitUser.class;
+ Class<?> niuClass = FieldNoisyInitUser.class;
System.out.println("called const-class FieldNoisyInitUser.class");
// Getting the declared fields doesn't run <clinit>.
@@ -480,14 +479,14 @@
public static void checkClinitForMethods() throws Exception {
// Loading a class constant shouldn't run <clinit>.
System.out.println("calling const-class MethodNoisyInitUser.class");
- Class niuClass = MethodNoisyInitUser.class;
+ Class<?> niuClass = MethodNoisyInitUser.class;
System.out.println("called const-class MethodNoisyInitUser.class");
// Getting the declared methods doesn't run <clinit>.
Method[] methods = niuClass.getDeclaredMethods();
System.out.println("got methods");
- Method method = niuClass.getMethod("staticMethod", (Class[]) null);
+ Method method = niuClass.getMethod("staticMethod");
System.out.println("got method");
method.invoke(null);
System.out.println("invoked method");
@@ -517,8 +516,7 @@
Method method;
try {
- method = Main.class.getMethod("fancyMethod",
- new Class[] { ArrayList.class });
+ method = Main.class.getMethod("fancyMethod", ArrayList.class);
} catch (NoSuchMethodException nsme) {
throw new RuntimeException(nsme);
}
@@ -527,9 +525,9 @@
System.out.println("generic method " + method.getName() + " params='"
+ stringifyTypeArray(parmTypes) + "' ret='" + ret + "'");
- Constructor ctor;
+ Constructor<?> ctor;
try {
- ctor = Main.class.getConstructor(new Class[] { ArrayList.class });
+ ctor = Main.class.getConstructor( ArrayList.class);
} catch (NoSuchMethodException nsme) {
throw new RuntimeException(nsme);
}
@@ -580,8 +578,8 @@
}
Method method1, method2;
try {
- method1 = Main.class.getMethod("fancyMethod", new Class[] { ArrayList.class });
- method2 = Main.class.getMethod("fancyMethod", new Class[] { ArrayList.class });
+ method1 = Main.class.getMethod("fancyMethod", ArrayList.class);
+ method2 = Main.class.getMethod("fancyMethod", ArrayList.class);
} catch (NoSuchMethodException nsme) {
throw new RuntimeException(nsme);
}
diff --git a/test/064-field-access/src/Main.java b/test/064-field-access/src/Main.java
index 5d90129..50ad5b9 100644
--- a/test/064-field-access/src/Main.java
+++ b/test/064-field-access/src/Main.java
@@ -38,7 +38,7 @@
}
try {
- Class c = Class.forName("SubClassUsingInaccessibleField");
+ Class<?> c = Class.forName("SubClassUsingInaccessibleField");
Object o = c.newInstance();
c.getMethod("test").invoke(o, null);
} catch (InvocationTargetException ite) {
@@ -64,7 +64,7 @@
* On success, the boxed value retrieved is returned.
*/
public Object getValue(Field field, Object obj, char type,
- Class expectedException) {
+ Class<?> expectedException) {
Object result = null;
try {
switch (type) {
@@ -638,7 +638,7 @@
* reflection call is significant]
*/
public Object getValue(Field field, Object obj, char type,
- Class expectedException) {
+ Class<?> expectedException) {
Object result = null;
try {
switch (type) {
@@ -698,7 +698,7 @@
return result;
}
- public Object invoke(Method method, Object obj, Class expectedException) {
+ public Object invoke(Method method, Object obj, Class<?> expectedException) {
Object result = null;
try {
result = method.invoke(obj);
diff --git a/test/068-classloader/src/FancyLoader.java b/test/068-classloader/src/FancyLoader.java
index 6a153cc..e616bfc 100644
--- a/test/068-classloader/src/FancyLoader.java
+++ b/test/068-classloader/src/FancyLoader.java
@@ -41,7 +41,7 @@
static final String DEX_FILE = System.getenv("DEX_LOCATION") + "/068-classloader-ex.jar";
/* on Dalvik, this is a DexFile; otherwise, it's null */
- private Class mDexClass;
+ private Class<?> mDexClass;
private Object mDexFile;
@@ -82,12 +82,12 @@
if (mDexFile == null) {
synchronized (FancyLoader.class) {
- Constructor ctor;
+ Constructor<?> ctor;
/*
* Construct a DexFile object through reflection.
*/
try {
- ctor = mDexClass.getConstructor(new Class[] {String.class});
+ ctor = mDexClass.getConstructor(String.class);
} catch (NoSuchMethodException nsme) {
throw new ClassNotFoundException("getConstructor failed",
nsme);
@@ -111,8 +111,7 @@
Method meth;
try {
- meth = mDexClass.getMethod("loadClass",
- new Class[] { String.class, ClassLoader.class });
+ meth = mDexClass.getMethod("loadClass", String.class, ClassLoader.class);
} catch (NoSuchMethodException nsme) {
throw new ClassNotFoundException("getMethod failed", nsme);
}
@@ -184,7 +183,7 @@
protected Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException
{
- Class res;
+ Class<?> res;
/*
* 1. Invoke findLoadedClass(String) to check if the class has
diff --git a/test/068-classloader/src/Main.java b/test/068-classloader/src/Main.java
index b2d843b..01539b7 100644
--- a/test/068-classloader/src/Main.java
+++ b/test/068-classloader/src/Main.java
@@ -74,11 +74,10 @@
/* this is the "alternate" DEX/Jar file */
String DEX_FILE = System.getenv("DEX_LOCATION") + "/068-classloader-ex.jar";
/* on Dalvik, this is a DexFile; otherwise, it's null */
- Class mDexClass = Class.forName("dalvik.system.DexFile");
- Constructor ctor = mDexClass.getConstructor(new Class[] {String.class});
+ Class<?> mDexClass = Class.forName("dalvik.system.DexFile");
+ Constructor<?> ctor = mDexClass.getConstructor(String.class);
Object mDexFile = ctor.newInstance(DEX_FILE);
- Method meth = mDexClass.getMethod("loadClass",
- new Class[] { String.class, ClassLoader.class });
+ Method meth = mDexClass.getMethod("loadClass", String.class, ClassLoader.class);
Object klass = meth.invoke(mDexFile, "Mutator", null);
if (klass == null) {
throw new AssertionError("loadClass with nullclass loader failed");
@@ -94,15 +93,15 @@
FancyLoader loader2 = new FancyLoader(ClassLoader.getSystemClassLoader());
try {
- Class target1 = loader1.loadClass("MutationTarget");
- Class target2 = loader2.loadClass("MutationTarget");
+ Class<?> target1 = loader1.loadClass("MutationTarget");
+ Class<?> target2 = loader2.loadClass("MutationTarget");
if (target1 == target2) {
throw new RuntimeException("target1 should not be equal to target2");
}
- Class mutator1 = loader1.loadClass("Mutator");
- Class mutator2 = loader2.loadClass("Mutator");
+ Class<?> mutator1 = loader1.loadClass("Mutator");
+ Class<?> mutator2 = loader2.loadClass("Mutator");
if (mutator1 == mutator2) {
throw new RuntimeException("mutator1 should not be equal to mutator2");
@@ -134,12 +133,12 @@
}
}
- private static void runMutator(Class c, int v) throws Exception {
+ private static void runMutator(Class<?> c, int v) throws Exception {
java.lang.reflect.Method m = c.getDeclaredMethod("mutate", int.class);
m.invoke(null, v);
}
- private static int getMutationTargetValue(Class c) throws Exception {
+ private static int getMutationTargetValue(Class<?> c) throws Exception {
java.lang.reflect.Field f = c.getDeclaredField("value");
return f.getInt(null);
}
@@ -149,7 +148,7 @@
* able to load it but not instantiate it.
*/
static void testAccess1(ClassLoader loader) {
- Class altClass;
+ Class<?> altClass;
try {
altClass = loader.loadClass("Inaccessible1");
@@ -179,7 +178,7 @@
* (though the base *is* accessible to us).
*/
static void testAccess2(ClassLoader loader) {
- Class altClass;
+ Class<?> altClass;
try {
altClass = loader.loadClass("Inaccessible2");
@@ -199,7 +198,7 @@
* See if we can load a class with an inaccessible interface.
*/
static void testAccess3(ClassLoader loader) {
- Class altClass;
+ Class<?> altClass;
try {
altClass = loader.loadClass("Inaccessible3");
@@ -219,7 +218,7 @@
* Test a doubled class that extends the base class.
*/
static void testExtend(ClassLoader loader) {
- Class doubledExtendClass;
+ Class<?> doubledExtendClass;
Object obj;
/* get the "alternate" version of DoubledExtend */
@@ -268,7 +267,7 @@
* it doesn't override the base class method.
*/
static void testExtendOkay(ClassLoader loader) {
- Class doubledExtendOkayClass;
+ Class<?> doubledExtendOkayClass;
Object obj;
/* get the "alternate" version of DoubledExtendOkay */
@@ -316,7 +315,7 @@
* an interface declared in a different class.
*/
static void testInterface(ClassLoader loader) {
- Class getDoubledClass;
+ Class<?> getDoubledClass;
Object obj;
/* get GetDoubled from the "alternate" class loader */
@@ -362,7 +361,7 @@
* Throw an abstract class into the middle and see what happens.
*/
static void testAbstract(ClassLoader loader) {
- Class abstractGetClass;
+ Class<?> abstractGetClass;
Object obj;
/* get AbstractGet from the "alternate" loader */
@@ -407,7 +406,7 @@
* Test a doubled class that implements a common interface.
*/
static void testImplement(ClassLoader loader) {
- Class doubledImplementClass;
+ Class<?> doubledImplementClass;
Object obj;
useImplement(new DoubledImplement(), true);
@@ -465,7 +464,7 @@
* that refers to a doubled class.
*/
static void testIfaceImplement(ClassLoader loader) {
- Class ifaceImplClass;
+ Class<?> ifaceImplClass;
Object obj;
/*
diff --git a/test/071-dexfile/src/Main.java b/test/071-dexfile/src/Main.java
index 2f85790..c3a9671 100644
--- a/test/071-dexfile/src/Main.java
+++ b/test/071-dexfile/src/Main.java
@@ -66,7 +66,7 @@
*/
private static void testDexClassLoader() throws Exception {
ClassLoader dexClassLoader = getDexClassLoader();
- Class Another = dexClassLoader.loadClass("Another");
+ Class<?> Another = dexClassLoader.loadClass("Another");
Object another = Another.newInstance();
// not expected to work; just exercises the call
dexClassLoader.getResource("nonexistent");
@@ -79,18 +79,21 @@
*/
private static ClassLoader getDexClassLoader() throws Exception {
ClassLoader classLoader = Main.class.getClassLoader();
- Class DexClassLoader = classLoader.loadClass("dalvik.system.DexClassLoader");
- Constructor DexClassLoader_init = DexClassLoader.getConstructor(String.class,
- String.class,
- String.class,
- ClassLoader.class);
+ Class<?> DexClassLoader = classLoader.loadClass("dalvik.system.DexClassLoader");
+ Constructor<?> DexClassLoader_init = DexClassLoader.getConstructor(String.class,
+ String.class,
+ String.class,
+ ClassLoader.class);
// create an instance, using the path we found
- return (ClassLoader) DexClassLoader_init.newInstance(CLASS_PATH, getOdexDir(), LIB_DIR, classLoader);
+ return (ClassLoader) DexClassLoader_init.newInstance(CLASS_PATH,
+ getOdexDir(),
+ LIB_DIR,
+ classLoader);
}
private static void testDexFile() throws Exception {
ClassLoader classLoader = Main.class.getClassLoader();
- Class DexFile = classLoader.loadClass("dalvik.system.DexFile");
+ Class<?> DexFile = classLoader.loadClass("dalvik.system.DexFile");
Method DexFile_loadDex = DexFile.getMethod("loadDex",
String.class,
String.class,
diff --git a/test/074-gc-thrash/src/Main.java b/test/074-gc-thrash/src/Main.java
index f947d0b..df04793 100644
--- a/test/074-gc-thrash/src/Main.java
+++ b/test/074-gc-thrash/src/Main.java
@@ -69,7 +69,7 @@
*/
private static Method getDumpHprofDataMethod() {
ClassLoader myLoader = Main.class.getClassLoader();
- Class vmdClass;
+ Class<?> vmdClass;
try {
vmdClass = myLoader.loadClass("dalvik.system.VMDebug");
} catch (ClassNotFoundException cnfe) {
@@ -78,8 +78,7 @@
Method meth;
try {
- meth = vmdClass.getMethod("dumpHprofData",
- new Class[] { String.class });
+ meth = vmdClass.getMethod("dumpHprofData", String.class);
} catch (NoSuchMethodException nsme) {
System.err.println("Found VMDebug but not dumpHprofData method");
return null;
diff --git a/test/080-oom-throw/src/Main.java b/test/080-oom-throw/src/Main.java
index f007b25..0ae92a9 100644
--- a/test/080-oom-throw/src/Main.java
+++ b/test/080-oom-throw/src/Main.java
@@ -105,7 +105,7 @@
static boolean triggerReflectionOOM() {
try {
Class<?> c = Main.class;
- Method m = c.getMethod("blowup", (Class[]) null);
+ Method m = c.getMethod("blowup");
holder = new Object[1000000];
m.invoke(null);
holder = null;
diff --git a/test/086-null-super/src/Main.java b/test/086-null-super/src/Main.java
index 060737f..8bd1786 100644
--- a/test/086-null-super/src/Main.java
+++ b/test/086-null-super/src/Main.java
@@ -75,14 +75,12 @@
* Find the DexFile class, and construct a DexFile object
* through reflection, then call loadCLass on it.
*/
- Class mDexClass = ClassLoader.getSystemClassLoader().
+ Class<?> mDexClass = ClassLoader.getSystemClassLoader().
loadClass("dalvik.system.DexFile");
- Constructor ctor = mDexClass.
- getConstructor(new Class[] {String.class});
+ Constructor<?> ctor = mDexClass.getConstructor(String.class);
Object mDexFile = ctor.newInstance(DEX_FILE);
Method meth = mDexClass.
- getMethod("loadClass",
- new Class[] { String.class, ClassLoader.class });
+ getMethod("loadClass", String.class, ClassLoader.class);
/*
* Invoking loadClass on CLASS_NAME is expected to
* throw an InvocationTargetException. Anything else
diff --git a/test/087-gc-after-link/src/Main.java b/test/087-gc-after-link/src/Main.java
index 7c47e99..698af0b 100644
--- a/test/087-gc-after-link/src/Main.java
+++ b/test/087-gc-after-link/src/Main.java
@@ -70,7 +70,7 @@
throws TestFailed, InvocationTargetException
{
Object dexFile = null;
- Class dexClass = null;
+ Class<?> dexClass = null;
try {
try {
@@ -80,11 +80,9 @@
*/
dexClass = ClassLoader.getSystemClassLoader().
loadClass("dalvik.system.DexFile");
- Constructor ctor = dexClass.
- getConstructor(new Class[] {String.class});
+ Constructor<?> ctor = dexClass.getConstructor(String.class);
dexFile = ctor.newInstance(DEX_FILE);
- Method meth = dexClass.getMethod("loadClass",
- new Class[] { String.class, ClassLoader.class });
+ Method meth = dexClass.getMethod("loadClass", String.class, ClassLoader.class);
/*
* Invoking loadClass on CLASS_NAME is expected to
* throw an InvocationTargetException. Anything else
@@ -95,7 +93,7 @@
} finally {
if (dexFile != null) {
/* close the DexFile to make CloseGuard happy */
- Method meth = dexClass.getMethod("close", (Class[]) null);
+ Method meth = dexClass.getMethod("close");
meth.invoke(dexFile);
}
}
diff --git a/test/088-monitor-verification/src/Main.java b/test/088-monitor-verification/src/Main.java
index 212c894..a6f0e64 100644
--- a/test/088-monitor-verification/src/Main.java
+++ b/test/088-monitor-verification/src/Main.java
@@ -100,7 +100,7 @@
*/
void constantLock() {
assertIsManaged();
- Class thing = Thread.class;
+ Class<?> thing = Thread.class;
synchronized (Thread.class) {}
}
diff --git a/test/098-ddmc/src/Main.java b/test/098-ddmc/src/Main.java
index 50bbe51..72c5a28 100644
--- a/test/098-ddmc/src/Main.java
+++ b/test/098-ddmc/src/Main.java
@@ -136,7 +136,7 @@
private static final Method getRecentAllocationsMethod;
static {
try {
- Class c = Class.forName("org.apache.harmony.dalvik.ddmc.DdmVmInternal");
+ Class<?> c = Class.forName("org.apache.harmony.dalvik.ddmc.DdmVmInternal");
enableRecentAllocationsMethod = c.getDeclaredMethod("enableRecentAllocations",
Boolean.TYPE);
getRecentAllocationStatusMethod = c.getDeclaredMethod("getRecentAllocationStatus");
diff --git a/test/099-vmdebug/src/Main.java b/test/099-vmdebug/src/Main.java
index 8068721..90ad315 100644
--- a/test/099-vmdebug/src/Main.java
+++ b/test/099-vmdebug/src/Main.java
@@ -242,7 +242,7 @@
System.out.println("Instances of null " + VMDebug.countInstancesofClass(null, false));
System.out.println("Instances of ClassA assignable " +
VMDebug.countInstancesofClass(ClassA.class, true));
- Class[] classes = new Class[]{ClassA.class, ClassB.class, null};
+ Class<?>[] classes = new Class<?>[] {ClassA.class, ClassB.class, null};
long[] counts = VMDebug.countInstancesofClasses(classes, false);
System.out.println("Array counts " + Arrays.toString(counts));
counts = VMDebug.countInstancesofClasses(classes, true);
@@ -259,7 +259,7 @@
private static final Method countInstancesOfClassesMethod;
static {
try {
- Class c = Class.forName("dalvik.system.VMDebug");
+ Class<?> c = Class.forName("dalvik.system.VMDebug");
startMethodTracingMethod = c.getDeclaredMethod("startMethodTracing", String.class,
Integer.TYPE, Integer.TYPE, Boolean.TYPE, Integer.TYPE);
stopMethodTracingMethod = c.getDeclaredMethod("stopMethodTracing");
@@ -292,10 +292,10 @@
public static Map<String, String> getRuntimeStats() throws Exception {
return (Map<String, String>) getRuntimeStatsMethod.invoke(null);
}
- public static long countInstancesofClass(Class c, boolean assignable) throws Exception {
+ public static long countInstancesofClass(Class<?> c, boolean assignable) throws Exception {
return (long) countInstancesOfClassMethod.invoke(null, new Object[]{c, assignable});
}
- public static long[] countInstancesofClasses(Class[] classes, boolean assignable)
+ public static long[] countInstancesofClasses(Class<?>[] classes, boolean assignable)
throws Exception {
return (long[]) countInstancesOfClassesMethod.invoke(
null, new Object[]{classes, assignable});
diff --git a/test/100-reflect2/src/Main.java b/test/100-reflect2/src/Main.java
index 1245852..91ba307 100644
--- a/test/100-reflect2/src/Main.java
+++ b/test/100-reflect2/src/Main.java
@@ -275,10 +275,8 @@
}
public static void testConstructorReflection() throws Exception {
- Constructor<?> ctor;
-
- ctor = String.class.getConstructor(new Class[0]);
- show(ctor.newInstance((Object[]) null));
+ Constructor<String> ctor = String.class.getConstructor();
+ show(ctor.newInstance());
ctor = String.class.getConstructor(char[].class, int.class, int.class);
show(ctor.newInstance(new char[] { '\u2714', 'y', 'z', '!' }, 1, 2));
@@ -287,7 +285,7 @@
private static void testPackagePrivateConstructor() {
try {
Class<?> c = Class.forName("sub.PPClass");
- Constructor cons = c.getConstructor();
+ Constructor<?> cons = c.getConstructor();
cons.newInstance();
throw new RuntimeException("Expected IllegalAccessException.");
} catch (IllegalAccessException e) {
@@ -301,7 +299,7 @@
private static void testPackagePrivateAccessibleConstructor() {
try {
Class<?> c = Class.forName("sub.PPClass");
- Constructor cons = c.getConstructor();
+ Constructor<?> cons = c.getConstructor();
cons.setAccessible(true); // ensure we prevent IllegalAccessException
cons.newInstance();
} catch (Exception e) {
diff --git a/test/107-int-math2/src/Main.java b/test/107-int-math2/src/Main.java
index 0c91d44..ec5678d 100644
--- a/test/107-int-math2/src/Main.java
+++ b/test/107-int-math2/src/Main.java
@@ -104,7 +104,7 @@
}
static int constClassTest(int x) {
- Class c = String.class;
+ Class<?> c = String.class;
if (c != null) {
return x * 2;
} else {
diff --git a/test/118-noimage-dex2oat/src/Main.java b/test/118-noimage-dex2oat/src/Main.java
index dba9166..cc19107 100644
--- a/test/118-noimage-dex2oat/src/Main.java
+++ b/test/118-noimage-dex2oat/src/Main.java
@@ -51,7 +51,7 @@
private static final Method isBootClassPathOnDiskMethod;
static {
try {
- Class c = Class.forName("dalvik.system.VMRuntime");
+ Class<?> c = Class.forName("dalvik.system.VMRuntime");
getCurrentInstructionSetMethod = c.getDeclaredMethod("getCurrentInstructionSet");
isBootClassPathOnDiskMethod = c.getDeclaredMethod("isBootClassPathOnDisk",
String.class);
diff --git a/test/125-gc-and-classloading/src/Main.java b/test/125-gc-and-classloading/src/Main.java
index 61e123d..e81ef7b 100644
--- a/test/125-gc-and-classloading/src/Main.java
+++ b/test/125-gc-and-classloading/src/Main.java
@@ -57,7 +57,7 @@
public void run() {
try {
cdl.await();
- Class c0 = Class.forName("Main$BigClass");
+ Class<?> c0 = Class.forName("Main$BigClass");
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/test/130-hprof/src/Main.java b/test/130-hprof/src/Main.java
index 9868c61..c145f27 100644
--- a/test/130-hprof/src/Main.java
+++ b/test/130-hprof/src/Main.java
@@ -37,15 +37,15 @@
private static Object allocInDifferentLoader() throws Exception {
final String DEX_FILE = System.getenv("DEX_LOCATION") + "/130-hprof-ex.jar";
- Class pathClassLoader = Class.forName("dalvik.system.PathClassLoader");
+ Class<?> pathClassLoader = Class.forName("dalvik.system.PathClassLoader");
if (pathClassLoader == null) {
throw new AssertionError("Couldn't find path class loader class");
}
- Constructor constructor =
+ Constructor<?> constructor =
pathClassLoader.getDeclaredConstructor(String.class, ClassLoader.class);
ClassLoader loader = (ClassLoader)constructor.newInstance(
DEX_FILE, ClassLoader.getSystemClassLoader());
- Class allocator = loader.loadClass("Allocator");
+ Class<?> allocator = loader.loadClass("Allocator");
return allocator.getDeclaredMethod("allocObject", null).invoke(null);
}
@@ -105,7 +105,7 @@
System.out.println("Generated data.");
createDumpAndConv();
- Class klass = Class.forName("org.apache.harmony.dalvik.ddmc.DdmVmInternal");
+ Class<?> klass = Class.forName("org.apache.harmony.dalvik.ddmc.DdmVmInternal");
if (klass == null) {
throw new AssertionError("Couldn't find path class loader class");
}
@@ -153,7 +153,7 @@
*/
private static Method getDumpHprofDataMethod() {
ClassLoader myLoader = Main.class.getClassLoader();
- Class vmdClass;
+ Class<?> vmdClass;
try {
vmdClass = myLoader.loadClass("dalvik.system.VMDebug");
} catch (ClassNotFoundException cnfe) {
@@ -162,8 +162,7 @@
Method meth;
try {
- meth = vmdClass.getMethod("dumpHprofData",
- new Class[] { String.class });
+ meth = vmdClass.getMethod("dumpHprofData", String.class);
} catch (NoSuchMethodException nsme) {
System.err.println("Found VMDebug but not dumpHprofData method");
return null;
diff --git a/test/134-reg-promotion/src/Main.java b/test/134-reg-promotion/src/Main.java
index 008ac58..f633524 100644
--- a/test/134-reg-promotion/src/Main.java
+++ b/test/134-reg-promotion/src/Main.java
@@ -32,13 +32,13 @@
public static void main(String args[]) throws Exception {
Class<?> c = Class.forName("Test");
- Method m = c.getMethod("run", (Class[]) null);
+ Method m = c.getMethod("run");
for (int i = 0; i < 10; i++) {
holder = new char[128 * 1024][];
m.invoke(null, (Object[]) null);
holder = null;
}
- m = c.getMethod("run2", (Class[]) null);
+ m = c.getMethod("run2");
for (int i = 0; i < 10; i++) {
holder = new char[128 * 1024][];
m.invoke(null, (Object[]) null);
diff --git a/test/138-duplicate-classes-check/src/Main.java b/test/138-duplicate-classes-check/src/Main.java
index a2ef281..5ffceb9 100644
--- a/test/138-duplicate-classes-check/src/Main.java
+++ b/test/138-duplicate-classes-check/src/Main.java
@@ -38,7 +38,7 @@
getClass().getClassLoader());
try {
- Class testEx = loader.loadClass("TestEx");
+ Class<?> testEx = loader.loadClass("TestEx");
Method test = testEx.getDeclaredMethod("test");
test.invoke(null);
} catch (Exception exc) {
diff --git a/test/138-duplicate-classes-check2/src/FancyLoader.java b/test/138-duplicate-classes-check2/src/FancyLoader.java
index 7e2bb08..58b7ec4 100644
--- a/test/138-duplicate-classes-check2/src/FancyLoader.java
+++ b/test/138-duplicate-classes-check2/src/FancyLoader.java
@@ -42,7 +42,7 @@
"/138-duplicate-classes-check2-ex.jar";
/* on Dalvik, this is a DexFile; otherwise, it's null */
- private Class mDexClass;
+ private Class<?> mDexClass;
private Object mDexFile;
@@ -83,12 +83,12 @@
if (mDexFile == null) {
synchronized (FancyLoader.class) {
- Constructor ctor;
+ Constructor<?> ctor;
/*
* Construct a DexFile object through reflection.
*/
try {
- ctor = mDexClass.getConstructor(new Class[] {String.class});
+ ctor = mDexClass.getConstructor(String.class);
} catch (NoSuchMethodException nsme) {
throw new ClassNotFoundException("getConstructor failed",
nsme);
@@ -112,8 +112,7 @@
Method meth;
try {
- meth = mDexClass.getMethod("loadClass",
- new Class[] { String.class, ClassLoader.class });
+ meth = mDexClass.getMethod("loadClass", String.class, ClassLoader.class);
} catch (NoSuchMethodException nsme) {
throw new ClassNotFoundException("getMethod failed", nsme);
}
@@ -185,7 +184,7 @@
protected Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException
{
- Class res;
+ Class<?> res;
/*
* 1. Invoke findLoadedClass(String) to check if the class has
diff --git a/test/138-duplicate-classes-check2/src/Main.java b/test/138-duplicate-classes-check2/src/Main.java
index a9b5bb0..a0d6977 100644
--- a/test/138-duplicate-classes-check2/src/Main.java
+++ b/test/138-duplicate-classes-check2/src/Main.java
@@ -33,7 +33,7 @@
FancyLoader loader = new FancyLoader(getClass().getClassLoader());
try {
- Class testEx = loader.loadClass("TestEx");
+ Class<?> testEx = loader.loadClass("TestEx");
Method test = testEx.getDeclaredMethod("test");
test.invoke(null);
} catch (Exception exc) {
diff --git a/test/139-register-natives/src/Main.java b/test/139-register-natives/src/Main.java
index 8dd2131..11bd53f 100644
--- a/test/139-register-natives/src/Main.java
+++ b/test/139-register-natives/src/Main.java
@@ -47,7 +47,7 @@
}
}
- private native static int registerNatives(Class c);
+ private native static int registerNatives(Class<?> c);
private static void expectThrows(Base b) {
try {
diff --git a/test/141-class-unload/src/Main.java b/test/141-class-unload/src/Main.java
index 9ed8d28..f9b6180 100644
--- a/test/141-class-unload/src/Main.java
+++ b/test/141-class-unload/src/Main.java
@@ -28,11 +28,11 @@
public static void main(String[] args) throws Exception {
nativeLibraryName = args[0];
- Class pathClassLoader = Class.forName("dalvik.system.PathClassLoader");
+ Class<?> pathClassLoader = Class.forName("dalvik.system.PathClassLoader");
if (pathClassLoader == null) {
throw new AssertionError("Couldn't find path class loader class");
}
- Constructor constructor =
+ Constructor<?> constructor =
pathClassLoader.getDeclaredConstructor(String.class, String.class, ClassLoader.class);
try {
testUnloadClass(constructor);
@@ -67,7 +67,7 @@
System.out.println("Number of loaded unload-ex maps " + count);
}
- private static void stressTest(Constructor constructor) throws Exception {
+ private static void stressTest(Constructor<?> constructor) throws Exception {
for (int i = 0; i <= 100; ++i) {
setUpUnloadLoader(constructor, false);
if (i % 10 == 0) {
@@ -76,7 +76,7 @@
}
}
- private static void testUnloadClass(Constructor constructor) throws Exception {
+ private static void testUnloadClass(Constructor<?> constructor) throws Exception {
WeakReference<Class> klass = setUpUnloadClassWeak(constructor);
// No strong references to class loader, should get unloaded.
Runtime.getRuntime().gc();
@@ -87,7 +87,7 @@
System.out.println(klass2.get());
}
- private static void testUnloadLoader(Constructor constructor)
+ private static void testUnloadLoader(Constructor<?> constructor)
throws Exception {
WeakReference<ClassLoader> loader = setUpUnloadLoader(constructor, true);
// No strong references to class loader, should get unloaded.
@@ -96,8 +96,8 @@
System.out.println(loader.get());
}
- private static void testStackTrace(Constructor constructor) throws Exception {
- Class klass = setUpUnloadClass(constructor);
+ private static void testStackTrace(Constructor<?> constructor) throws Exception {
+ Class<?> klass = setUpUnloadClass(constructor);
WeakReference<Class> weak_klass = new WeakReference(klass);
Method stackTraceMethod = klass.getDeclaredMethod("generateStackTrace");
Throwable throwable = (Throwable) stackTraceMethod.invoke(klass);
@@ -108,7 +108,7 @@
System.out.println("class null " + isNull + " " + throwable.getMessage());
}
- private static void testLoadAndUnloadLibrary(Constructor constructor) throws Exception {
+ private static void testLoadAndUnloadLibrary(Constructor<?> constructor) throws Exception {
WeakReference<ClassLoader> loader = setUpLoadLibrary(constructor);
// No strong references to class loader, should get unloaded.
Runtime.getRuntime().gc();
@@ -117,7 +117,7 @@
}
private static Object testNoUnloadHelper(ClassLoader loader) throws Exception {
- Class intHolder = loader.loadClass("IntHolder");
+ Class<?> intHolder = loader.loadClass("IntHolder");
return intHolder.newInstance();
}
@@ -131,14 +131,14 @@
public WeakReference<ClassLoader> classLoader;
}
- private static Pair testNoUnloadInstanceHelper(Constructor constructor) throws Exception {
+ private static Pair testNoUnloadInstanceHelper(Constructor<?> constructor) throws Exception {
ClassLoader loader = (ClassLoader) constructor.newInstance(
DEX_FILE, LIBRARY_SEARCH_PATH, ClassLoader.getSystemClassLoader());
Object o = testNoUnloadHelper(loader);
return new Pair(o, loader);
}
- private static void testNoUnloadInstance(Constructor constructor) throws Exception {
+ private static void testNoUnloadInstance(Constructor<?> constructor) throws Exception {
Pair p = testNoUnloadInstanceHelper(constructor);
Runtime.getRuntime().gc();
// If the class loader was unloded too early due to races, just pass the test.
@@ -146,10 +146,10 @@
System.out.println("loader null " + isNull);
}
- private static Class setUpUnloadClass(Constructor constructor) throws Exception {
+ private static Class<?> setUpUnloadClass(Constructor<?> constructor) throws Exception {
ClassLoader loader = (ClassLoader) constructor.newInstance(
DEX_FILE, LIBRARY_SEARCH_PATH, ClassLoader.getSystemClassLoader());
- Class intHolder = loader.loadClass("IntHolder");
+ Class<?> intHolder = loader.loadClass("IntHolder");
Method getValue = intHolder.getDeclaredMethod("getValue");
Method setValue = intHolder.getDeclaredMethod("setValue", Integer.TYPE);
// Make sure we don't accidentally preserve the value in the int holder, the class
@@ -161,17 +161,17 @@
return intHolder;
}
- private static WeakReference<Class> setUpUnloadClassWeak(Constructor constructor)
+ private static WeakReference<Class> setUpUnloadClassWeak(Constructor<?> constructor)
throws Exception {
return new WeakReference<Class>(setUpUnloadClass(constructor));
}
- private static WeakReference<ClassLoader> setUpUnloadLoader(Constructor constructor,
+ private static WeakReference<ClassLoader> setUpUnloadLoader(Constructor<?> constructor,
boolean waitForCompilation)
throws Exception {
ClassLoader loader = (ClassLoader) constructor.newInstance(
DEX_FILE, LIBRARY_SEARCH_PATH, ClassLoader.getSystemClassLoader());
- Class intHolder = loader.loadClass("IntHolder");
+ Class<?> intHolder = loader.loadClass("IntHolder");
Method setValue = intHolder.getDeclaredMethod("setValue", Integer.TYPE);
setValue.invoke(intHolder, 2);
if (waitForCompilation) {
@@ -180,7 +180,7 @@
return new WeakReference(loader);
}
- private static void waitForCompilation(Class intHolder) throws Exception {
+ private static void waitForCompilation(Class<?> intHolder) throws Exception {
// Load the native library so that we can call waitForCompilation.
Method loadLibrary = intHolder.getDeclaredMethod("loadLibrary", String.class);
loadLibrary.invoke(intHolder, nativeLibraryName);
@@ -189,11 +189,11 @@
waitForCompilation.invoke(intHolder);
}
- private static WeakReference<ClassLoader> setUpLoadLibrary(Constructor constructor)
+ private static WeakReference<ClassLoader> setUpLoadLibrary(Constructor<?> constructor)
throws Exception {
ClassLoader loader = (ClassLoader) constructor.newInstance(
DEX_FILE, LIBRARY_SEARCH_PATH, ClassLoader.getSystemClassLoader());
- Class intHolder = loader.loadClass("IntHolder");
+ Class<?> intHolder = loader.loadClass("IntHolder");
Method loadLibrary = intHolder.getDeclaredMethod("loadLibrary", String.class);
loadLibrary.invoke(intHolder, nativeLibraryName);
waitForCompilation(intHolder);
diff --git a/test/142-classloader2/src/Main.java b/test/142-classloader2/src/Main.java
index 89dadce..80b00e7 100644
--- a/test/142-classloader2/src/Main.java
+++ b/test/142-classloader2/src/Main.java
@@ -25,8 +25,8 @@
private static ClassLoader createClassLoader(String dexPath, ClassLoader parent) {
try {
Class<?> myClassLoaderClass = Class.forName("MyPathClassLoader");
- Constructor constructor = myClassLoaderClass.getConstructor(String.class,
- ClassLoader.class);
+ Constructor<?> constructor = myClassLoaderClass.getConstructor(String.class,
+ ClassLoader.class);
return (ClassLoader)constructor.newInstance(dexPath, parent);
} catch (Exception e) {
// Ups, not available?!?!
diff --git a/test/145-alloc-tracking-stress/src/Main.java b/test/145-alloc-tracking-stress/src/Main.java
index 752fdd9..4a67a80 100644
--- a/test/145-alloc-tracking-stress/src/Main.java
+++ b/test/145-alloc-tracking-stress/src/Main.java
@@ -31,7 +31,7 @@
}
public static void main(String[] args) throws Exception {
- Class klass = Class.forName("org.apache.harmony.dalvik.ddmc.DdmVmInternal");
+ Class<?> klass = Class.forName("org.apache.harmony.dalvik.ddmc.DdmVmInternal");
if (klass == null) {
throw new AssertionError("Couldn't find DdmVmInternal class");
}
diff --git a/test/148-multithread-gc-annotations/src/AnnoClass1.java b/test/148-multithread-gc-annotations/src/AnnoClass1.java
index b82c61f..3eb45ae 100644
--- a/test/148-multithread-gc-annotations/src/AnnoClass1.java
+++ b/test/148-multithread-gc-annotations/src/AnnoClass1.java
@@ -19,5 +19,5 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface AnnoClass1 {
- Class value();
+ Class<?> value();
}
diff --git a/test/148-multithread-gc-annotations/src/AnnoClass2.java b/test/148-multithread-gc-annotations/src/AnnoClass2.java
index c75d950..b17490f 100644
--- a/test/148-multithread-gc-annotations/src/AnnoClass2.java
+++ b/test/148-multithread-gc-annotations/src/AnnoClass2.java
@@ -19,5 +19,5 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface AnnoClass2 {
- Class value();
+ Class<?> value();
}
diff --git a/test/148-multithread-gc-annotations/src/AnnoClass3.java b/test/148-multithread-gc-annotations/src/AnnoClass3.java
index 5b4a378..7d600a8 100644
--- a/test/148-multithread-gc-annotations/src/AnnoClass3.java
+++ b/test/148-multithread-gc-annotations/src/AnnoClass3.java
@@ -19,5 +19,5 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface AnnoClass3 {
- Class value();
+ Class<?> value();
}
diff --git a/test/201-built-in-exception-detail-messages/src/Main.java b/test/201-built-in-exception-detail-messages/src/Main.java
index f0bb6dd..dc58819 100644
--- a/test/201-built-in-exception-detail-messages/src/Main.java
+++ b/test/201-built-in-exception-detail-messages/src/Main.java
@@ -247,7 +247,7 @@
* Helper for testCastOperatorWithArrays. It's important that
* the return type is Object.
*/
- private static Object makeArray(Class c) {
+ private static Object makeArray(Class<?> c) {
return Array.newInstance(c, 1);
}
diff --git a/test/420-const-class/src/Main.java b/test/420-const-class/src/Main.java
index 44a7436..90ccf3a 100644
--- a/test/420-const-class/src/Main.java
+++ b/test/420-const-class/src/Main.java
@@ -53,15 +53,15 @@
$opt$LoadAndClinitCheck();
}
- public static Class $opt$LoadThisClass() {
+ public static Class<?> $opt$LoadThisClass() {
return Main.class;
}
- public static Class $opt$LoadOtherClass() {
+ public static Class<?> $opt$LoadOtherClass() {
return Other.class;
}
- public static Class $opt$LoadSystemClass() {
+ public static Class<?> $opt$LoadSystemClass() {
return System.class;
}
diff --git a/test/450-checker-types/src/Main.java b/test/450-checker-types/src/Main.java
index 36f14d8..99a1557 100644
--- a/test/450-checker-types/src/Main.java
+++ b/test/450-checker-types/src/Main.java
@@ -103,7 +103,7 @@
/// CHECK-NOT: CheckCast
public String testClassRemove() {
Object s = SubclassA.class;
- return ((Class)s).getName();
+ return ((Class<?>)s).getName();
}
/// CHECK-START: java.lang.String Main.testClassKeep() instruction_simplifier (before)
diff --git a/test/458-checker-instruction-simplification/src/Main.java b/test/458-checker-instruction-simplification/src/Main.java
index 040479e..8a426eb 100644
--- a/test/458-checker-instruction-simplification/src/Main.java
+++ b/test/458-checker-instruction-simplification/src/Main.java
@@ -1859,7 +1859,7 @@
if (doThrow) { throw new Error(); }
try {
Class<?> c = Class.forName("SmaliTests");
- Method m = c.getMethod(name, new Class[] { boolean.class });
+ Method m = c.getMethod(name, boolean.class);
return (Integer) m.invoke(null, input);
} catch (Exception ex) {
throw new Error(ex);
diff --git a/test/462-checker-inlining-across-dex-files/src-multidex/OtherDex.java b/test/462-checker-inlining-across-dex-files/src-multidex/OtherDex.java
index 171ade8..2056e2f 100644
--- a/test/462-checker-inlining-across-dex-files/src-multidex/OtherDex.java
+++ b/test/462-checker-inlining-across-dex-files/src-multidex/OtherDex.java
@@ -38,25 +38,25 @@
return "OtherDex";
}
- public static Class returnOtherDexClass() {
+ public static Class<?> returnOtherDexClass() {
return OtherDex.class;
}
- public static Class returnMainClass() {
+ public static Class<?> returnMainClass() {
return Main.class;
}
- private static Class returnOtherDexClass2() {
+ private static Class<?> returnOtherDexClass2() {
return OtherDex.class;
}
- public static Class returnOtherDexClassStaticCall() {
+ public static Class<?> returnOtherDexClassStaticCall() {
// Do not call returnOtherDexClass, as it may have been flagged
// as non-inlineable.
return returnOtherDexClass2();
}
- public static Class returnOtherDexCallingMain() {
+ public static Class<?> returnOtherDexCallingMain() {
return Main.getOtherClass();
}
diff --git a/test/462-checker-inlining-across-dex-files/src/Main.java b/test/462-checker-inlining-across-dex-files/src/Main.java
index 1fe49a8..c2bb479 100644
--- a/test/462-checker-inlining-across-dex-files/src/Main.java
+++ b/test/462-checker-inlining-across-dex-files/src/Main.java
@@ -106,7 +106,7 @@
/// CHECK-DAG: <<Invoke:l\d+>> InvokeStaticOrDirect
/// CHECK-DAG: Return [<<Invoke>>]
- public static Class dontInlineOtherDexClass() {
+ public static Class<?> dontInlineOtherDexClass() {
return OtherDex.returnOtherDexClass();
}
@@ -123,7 +123,7 @@
// Note: There are two LoadClass instructions. We obtain the correct
// instruction id by matching the Return's input list first.
- public static Class inlineMainClass() {
+ public static Class<?> inlineMainClass() {
return OtherDex.returnMainClass();
}
@@ -135,7 +135,7 @@
/// CHECK-DAG: <<Invoke:l\d+>> InvokeStaticOrDirect
/// CHECK-DAG: Return [<<Invoke>>]
- public static Class dontInlineOtherDexClassStaticCall() {
+ public static Class<?> dontInlineOtherDexClassStaticCall() {
return OtherDex.returnOtherDexClassStaticCall();
}
@@ -152,11 +152,11 @@
// Note: There are two LoadClass instructions. We obtain the correct
// instruction id by matching the Return's input list first.
- public static Class inlineOtherDexCallingMain() {
+ public static Class<?> inlineOtherDexCallingMain() {
return OtherDex.returnOtherDexCallingMain();
}
- public static Class getOtherClass() {
+ public static Class<?> getOtherClass() {
return Main.class;
}
diff --git a/test/471-uninitialized-locals/src/Main.java b/test/471-uninitialized-locals/src/Main.java
index a5b1c48..1ac749e 100644
--- a/test/471-uninitialized-locals/src/Main.java
+++ b/test/471-uninitialized-locals/src/Main.java
@@ -24,8 +24,8 @@
public static void main(String args[]) throws Exception {
try {
Class<?> c = Class.forName("Test");
- Method m = c.getMethod("ThrowException", (Class[]) null);
- m.invoke(null, (Object[]) null);
+ Method m = c.getMethod("ThrowException");
+ m.invoke(null);
} catch (VerifyError e) {
// Compilation should go fine but we expect the runtime verification to fail.
return;
diff --git a/test/472-unreachable-if-regression/src/Main.java b/test/472-unreachable-if-regression/src/Main.java
index c9f9511..d426df1 100644
--- a/test/472-unreachable-if-regression/src/Main.java
+++ b/test/472-unreachable-if-regression/src/Main.java
@@ -25,12 +25,12 @@
System.out.println("Test started.");
Class<?> c = Class.forName("Test");
- Method unreachableIf = c.getMethod("UnreachableIf", (Class[]) null);
- unreachableIf.invoke(null, (Object[]) null);
+ Method unreachableIf = c.getMethod("UnreachableIf");
+ unreachableIf.invoke(null);
System.out.println("Successfully called UnreachableIf().");
- Method unreachablePackedSwitch = c.getMethod("UnreachablePackedSwitch", (Class[]) null);
- unreachablePackedSwitch.invoke(null, (Object[]) null);
+ Method unreachablePackedSwitch = c.getMethod("UnreachablePackedSwitch");
+ unreachablePackedSwitch.invoke(null);
System.out.println("Successfully called UnreachablePackedSwitch().");
}
diff --git a/test/489-current-method-regression/src/Main.java b/test/489-current-method-regression/src/Main.java
index 7d102f5..285c41d 100644
--- a/test/489-current-method-regression/src/Main.java
+++ b/test/489-current-method-regression/src/Main.java
@@ -23,7 +23,7 @@
if (a == 42) {
// The class loading will be seen as dead code by
// the optimizer.
- Class c = Main.class;
+ Class<?> c = Main.class;
}
return new Main().bar();
}
diff --git a/test/496-checker-inlining-and-class-loader/src/Main.java b/test/496-checker-inlining-and-class-loader/src/Main.java
index 8de6318..91cf0a0 100644
--- a/test/496-checker-inlining-and-class-loader/src/Main.java
+++ b/test/496-checker-inlining-and-class-loader/src/Main.java
@@ -69,7 +69,7 @@
"loadClassBinaryName", String.class, ClassLoader.class, List.class);
if (dexFile != null) {
- Class clazz = (Class)method.invoke(dexFile, className, this, null);
+ Class<?> clazz = (Class<?>)method.invoke(dexFile, className, this, null);
if (clazz != null) {
return clazz;
}
@@ -123,7 +123,7 @@
public class Main {
public static void main(String[] args) throws Exception {
MyClassLoader o = new MyClassLoader();
- Class foo = o.loadClass("LoadedByMyClassLoader");
+ Class<?> foo = o.loadClass("LoadedByMyClassLoader");
Method m = foo.getDeclaredMethod("bar");
m.invoke(null);
}
diff --git a/test/497-inlining-and-class-loader/src/Main.java b/test/497-inlining-and-class-loader/src/Main.java
index 832b1f0..1e27e77 100644
--- a/test/497-inlining-and-class-loader/src/Main.java
+++ b/test/497-inlining-and-class-loader/src/Main.java
@@ -66,7 +66,7 @@
"loadClassBinaryName", String.class, ClassLoader.class, List.class);
if (dex != null) {
- Class clazz = (Class)method.invoke(dex, className, this, null);
+ Class<?> clazz = (Class<?>)method.invoke(dex, className, this, null);
if (clazz != null) {
return clazz;
}
@@ -92,7 +92,7 @@
MyClassLoader o = new MyClassLoader();
MyClassLoader.level1ClassLoader = new MyClassLoader();
- Class foo = o.loadClass("LoadedByMyClassLoader");
+ Class<?> foo = o.loadClass("LoadedByMyClassLoader");
Method m = foo.getDeclaredMethod("bar");
try {
m.invoke(null);
diff --git a/test/501-regression-packed-switch/src/Main.java b/test/501-regression-packed-switch/src/Main.java
index 12bc1a8..74c081a 100644
--- a/test/501-regression-packed-switch/src/Main.java
+++ b/test/501-regression-packed-switch/src/Main.java
@@ -24,12 +24,12 @@
public static void main(String args[]) throws Exception {
Class<?> c = Class.forName("Test");
- Method m = c.getMethod("EmptyPackedSwitch", new Class[] { int.class });
+ Method m = c.getMethod("EmptyPackedSwitch", int.class);
Integer result = (Integer) m.invoke(null, new Integer(42));
if (result != 5) {
throw new Error("Expected 5, got " + result);
}
- m = c.getMethod("PackedSwitchAfterData", new Class[] { int.class });
+ m = c.getMethod("PackedSwitchAfterData", int.class);
result = (Integer) m.invoke(null, new Integer(0));
if (result != 1) {
throw new Error("Expected 1, got " + result);
diff --git a/test/504-regression-baseline-entry/src/Main.java b/test/504-regression-baseline-entry/src/Main.java
index 2c9df28..284cbdc 100644
--- a/test/504-regression-baseline-entry/src/Main.java
+++ b/test/504-regression-baseline-entry/src/Main.java
@@ -24,7 +24,7 @@
public static void main(String args[]) throws Exception {
Class<?> c = Class.forName("Test");
- Method m = c.getMethod("SingleGotoStart", (Class[]) null);
+ Method m = c.getMethod("SingleGotoStart");
Integer result = (Integer) m.invoke(null);
if (result != 5) {
throw new Error("Expected 5, got " + result);
diff --git a/test/510-checker-try-catch/src/Main.java b/test/510-checker-try-catch/src/Main.java
index 25cdc0e..d6dcd30 100644
--- a/test/510-checker-try-catch/src/Main.java
+++ b/test/510-checker-try-catch/src/Main.java
@@ -39,7 +39,7 @@
public static void testMethod(String method) throws Exception {
Class<?> c = Class.forName("Runtime");
- Method m = c.getMethod(method, new Class[] { boolean.class, boolean.class });
+ Method m = c.getMethod(method, boolean.class, boolean.class);
for (TestPath path : TestPath.values()) {
Object[] arguments = new Object[] { path.arg1, path.arg2 };
diff --git a/test/517-checker-builder-fallthrough/src/Main.java b/test/517-checker-builder-fallthrough/src/Main.java
index 23d94e6..14170f5 100644
--- a/test/517-checker-builder-fallthrough/src/Main.java
+++ b/test/517-checker-builder-fallthrough/src/Main.java
@@ -20,7 +20,7 @@
public static int runTest(int input) throws Exception {
Class<?> c = Class.forName("TestCase");
- Method m = c.getMethod("testCase", new Class[] { int.class });
+ Method m = c.getMethod("testCase", int.class);
return (Integer) m.invoke(null, input);
}
diff --git a/test/522-checker-regression-monitor-exit/src/Main.java b/test/522-checker-regression-monitor-exit/src/Main.java
index c85ac96..a5e9512 100644
--- a/test/522-checker-regression-monitor-exit/src/Main.java
+++ b/test/522-checker-regression-monitor-exit/src/Main.java
@@ -40,7 +40,7 @@
Integer result;
try {
Class<?> c = Class.forName("Test");
- Method m = c.getMethod("synchronizedHashCode", new Class[] { Object.class });
+ Method m = c.getMethod("synchronizedHashCode", Object.class);
result = (Integer) m.invoke(null, m_obj);
} catch (Exception e) {
System.err.println("Hash code query exception");
diff --git a/test/542-unresolved-access-check/src/Main.java b/test/542-unresolved-access-check/src/Main.java
index 2bdf47f..62bfea1 100644
--- a/test/542-unresolved-access-check/src/Main.java
+++ b/test/542-unresolved-access-check/src/Main.java
@@ -58,7 +58,7 @@
"loadClassBinaryName", String.class, ClassLoader.class, List.class);
if (dex != null) {
- Class clazz = (Class)method.invoke(dex, className, this, null);
+ Class<?> clazz = (Class<?>)method.invoke(dex, className, this, null);
if (clazz != null) {
return clazz;
}
@@ -72,7 +72,7 @@
public class Main {
public static void main(String[] args) throws Exception {
MyClassLoader o = new MyClassLoader();
- Class foo = o.loadClass("LoadedByMyClassLoader");
+ Class<?> foo = o.loadClass("LoadedByMyClassLoader");
Method m = foo.getDeclaredMethod("main");
m.invoke(null);
}
diff --git a/test/545-tracing-and-jit/src/Main.java b/test/545-tracing-and-jit/src/Main.java
index a2d51d5..f365c6e 100644
--- a/test/545-tracing-and-jit/src/Main.java
+++ b/test/545-tracing-and-jit/src/Main.java
@@ -226,7 +226,7 @@
private static final Method getMethodTracingModeMethod;
static {
try {
- Class c = Class.forName("dalvik.system.VMDebug");
+ Class<?> c = Class.forName("dalvik.system.VMDebug");
startMethodTracingMethod = c.getDeclaredMethod("startMethodTracing", String.class,
Integer.TYPE, Integer.TYPE, Boolean.TYPE, Integer.TYPE);
stopMethodTracingMethod = c.getDeclaredMethod("stopMethodTracing");
diff --git a/test/552-checker-primitive-typeprop/src/Main.java b/test/552-checker-primitive-typeprop/src/Main.java
index fe2343e..1296800 100644
--- a/test/552-checker-primitive-typeprop/src/Main.java
+++ b/test/552-checker-primitive-typeprop/src/Main.java
@@ -29,15 +29,15 @@
public static void main(String[] args) throws Exception {
Class<?> c = Class.forName("SsaBuilder");
- Method m = c.getMethod("environmentPhi", new Class[] { boolean.class, int[].class });
+ Method m = c.getMethod("environmentPhi", boolean.class, int[].class);
int[] array = new int[3];
int result;
- result = (Integer) m.invoke(null, new Object[] { true, array } );
+ result = (Integer) m.invoke(null, true, array);
assertEquals(2, result);
- result = (Integer) m.invoke(null, new Object[] { false, array } );
+ result = (Integer) m.invoke(null, false, array);
assertEquals(0, result);
}
}
diff --git a/test/566-polymorphic-inlining/src/Main.java b/test/566-polymorphic-inlining/src/Main.java
index 53852a4..793b85f 100644
--- a/test/566-polymorphic-inlining/src/Main.java
+++ b/test/566-polymorphic-inlining/src/Main.java
@@ -15,9 +15,9 @@
*/
interface Itf {
- public Class sameInvokeInterface();
- public Class sameInvokeInterface2();
- public Class sameInvokeInterface3();
+ public Class<?> sameInvokeInterface();
+ public Class<?> sameInvokeInterface2();
+ public Class<?> sameInvokeInterface3();
}
public class Main implements Itf {
@@ -81,31 +81,31 @@
assertEquals(20001, counter);
}
- public Class sameInvokeVirtual() {
+ public Class<?> sameInvokeVirtual() {
field.getClass(); // null check to ensure we get an inlined frame in the CodeInfo.
return Main.class;
}
- public Class sameInvokeInterface() {
+ public Class<?> sameInvokeInterface() {
field.getClass(); // null check to ensure we get an inlined frame in the CodeInfo.
return Itf.class;
}
- public Class sameInvokeInterface2() {
+ public Class<?> sameInvokeInterface2() {
field.getClass(); // null check to ensure we get an inlined frame in the CodeInfo.
return Itf.class;
}
- public Class sameInvokeInterface3() {
+ public Class<?> sameInvokeInterface3() {
field.getClass(); // null check to ensure we get an inlined frame in the CodeInfo.
return Itf.class;
}
- public static Class testInvokeInterface(Itf i) {
+ public static Class<?> testInvokeInterface(Itf i) {
return i.sameInvokeInterface();
}
- public static Class testInvokeInterface2(Itf i) {
+ public static Class<?> testInvokeInterface2(Itf i) {
// Make three interface calls that will do a ClassTableGet to ensure bogus code
// generation of ClassTableGet will crash.
i.sameInvokeInterface();
@@ -113,7 +113,7 @@
return i.sameInvokeInterface3();
}
- public static Class testInvokeVirtual(Main m) {
+ public static Class<?> testInvokeVirtual(Main m) {
return m.sameInvokeVirtual();
}
@@ -139,18 +139,18 @@
}
class OtherSubclass extends Main {
- public Class sameInvokeVirtual() {
+ public Class<?> sameInvokeVirtual() {
return OtherSubclass.class;
}
- public Class sameInvokeInterface() {
+ public Class<?> sameInvokeInterface() {
return OtherSubclass.class;
}
- public Class sameInvokeInterface2() {
+ public Class<?> sameInvokeInterface2() {
return null;
}
- public Class sameInvokeInterface3() {
+ public Class<?> sameInvokeInterface3() {
return null;
}
}
diff --git a/test/570-checker-osr/src/Main.java b/test/570-checker-osr/src/Main.java
index 15c232d..8af3894 100644
--- a/test/570-checker-osr/src/Main.java
+++ b/test/570-checker-osr/src/Main.java
@@ -129,7 +129,7 @@
DeoptimizationController.startDeoptimization();
}
- public static Class $noinline$inlineCache(Main m, boolean isSecondInvocation) {
+ public static Class<?> $noinline$inlineCache(Main m, boolean isSecondInvocation) {
// If we are running in non-JIT mode, or were unlucky enough to get this method
// already JITted, just return the expected value.
if (!isInInterpreter("$noinline$inlineCache")) {
@@ -159,7 +159,7 @@
return other.returnClass();
}
- public static Class $noinline$inlineCache2(Main m, boolean isSecondInvocation) {
+ public static Class<?> $noinline$inlineCache2(Main m, boolean isSecondInvocation) {
// If we are running in non-JIT mode, or were unlucky enough to get this method
// already JITted, just return the expected value.
if (!isInInterpreter("$noinline$inlineCache2")) {
@@ -188,7 +188,7 @@
return (other == null) ? null : other.returnClass();
}
- public static Class $noinline$inlineCache3(Main m, boolean isSecondInvocation) {
+ public static Class<?> $noinline$inlineCache3(Main m, boolean isSecondInvocation) {
// If we are running in non-JIT mode, or were unlucky enough to get this method
// already JITted, just return the expected value.
if (!isInInterpreter("$noinline$inlineCache3")) {
@@ -229,7 +229,7 @@
return null;
}
- public Class returnClass() {
+ public Class<?> returnClass() {
return Main.class;
}
@@ -305,7 +305,7 @@
}
class SubMain extends Main {
- public Class returnClass() {
+ public Class<?> returnClass() {
return SubMain.class;
}
diff --git a/test/576-polymorphic-inlining/src/Main.java b/test/576-polymorphic-inlining/src/Main.java
index d8d09af..5763d89 100644
--- a/test/576-polymorphic-inlining/src/Main.java
+++ b/test/576-polymorphic-inlining/src/Main.java
@@ -65,11 +65,11 @@
public void willOnlyInlineForMainVoid() {
}
- public Class willInlineWithReturnValue() {
+ public Class<?> willInlineWithReturnValue() {
return Main.class;
}
- public Class willOnlyInlineForMainWithReturnValue() {
+ public Class<?> willOnlyInlineForMainWithReturnValue() {
return Main.class;
}
public static boolean doThrow;
@@ -83,21 +83,21 @@
public void willInlineVoid() {
}
- public Class willInlineWithReturnValue() {
+ public Class<?> willInlineWithReturnValue() {
return SubMain.class;
}
- public Class willOnlyInlineForMainWithReturnValue() {
+ public Class<?> willOnlyInlineForMainWithReturnValue() {
return SubMain.class;
}
}
class SubSubMain extends SubMain {
- public Class willInlineWithReturnValue() {
+ public Class<?> willInlineWithReturnValue() {
return SubSubMain.class;
}
- public Class willOnlyInlineForMainWithReturnValue() {
+ public Class<?> willOnlyInlineForMainWithReturnValue() {
return SubSubMain.class;
}
}
diff --git a/test/577-profile-foreign-dex/src/Main.java b/test/577-profile-foreign-dex/src/Main.java
index 0cd85b5..ed7a625 100644
--- a/test/577-profile-foreign-dex/src/Main.java
+++ b/test/577-profile-foreign-dex/src/Main.java
@@ -111,11 +111,11 @@
}
private static void loadDexFile(String dexFile) throws Exception {
- Class pathClassLoader = Class.forName("dalvik.system.PathClassLoader");
+ Class<?> pathClassLoader = Class.forName("dalvik.system.PathClassLoader");
if (pathClassLoader == null) {
throw new RuntimeException("Couldn't find path class loader class");
}
- Constructor constructor =
+ Constructor<?> constructor =
pathClassLoader.getDeclaredConstructor(String.class, ClassLoader.class);
constructor.newInstance(
dexFile, ClassLoader.getSystemClassLoader());
@@ -125,7 +125,7 @@
private static final Method registerAppInfoMethod;
static {
try {
- Class c = Class.forName("dalvik.system.VMRuntime");
+ Class<?> c = Class.forName("dalvik.system.VMRuntime");
registerAppInfoMethod = c.getDeclaredMethod("registerAppInfo",
String.class, String.class, String[].class, String.class);
} catch (Exception e) {
diff --git a/test/601-method-access/src/Main.java b/test/601-method-access/src/Main.java
index 838080a..9d9e568 100644
--- a/test/601-method-access/src/Main.java
+++ b/test/601-method-access/src/Main.java
@@ -22,7 +22,7 @@
public class Main {
public static void main(String[] args) {
try {
- Class c = Class.forName("SubClassUsingInaccessibleMethod");
+ Class<?> c = Class.forName("SubClassUsingInaccessibleMethod");
Object o = c.newInstance();
c.getMethod("test").invoke(o, null);
} catch (InvocationTargetException ite) {
diff --git a/test/604-hot-static-interface/src/Main.java b/test/604-hot-static-interface/src/Main.java
index 04d7cd6..a26623c 100644
--- a/test/604-hot-static-interface/src/Main.java
+++ b/test/604-hot-static-interface/src/Main.java
@@ -29,7 +29,7 @@
}
}
- private static native void ensureJitCompiled(Class itf, String method_name);
+ private static native void ensureJitCompiled(Class<?> itf, String method_name);
}
interface Itf {
diff --git a/test/605-new-string-from-bytes/src/Main.java b/test/605-new-string-from-bytes/src/Main.java
index 7dc0c15..5bd6c5d 100644
--- a/test/605-new-string-from-bytes/src/Main.java
+++ b/test/605-new-string-from-bytes/src/Main.java
@@ -20,7 +20,7 @@
public class Main {
public static void main(String[] args) throws Exception {
- Class c = Class.forName("java.lang.StringFactory");
+ Class<?> c = Class.forName("java.lang.StringFactory");
Method m = c.getDeclaredMethod("newStringFromBytes", byte[].class, int.class);
// Loop over allocations to get more chances of doing GC while in the
diff --git a/test/612-jit-dex-cache/src-ex/LoadedByAppClassLoader.java b/test/612-jit-dex-cache/src-ex/LoadedByAppClassLoader.java
index 1d6158a..fcb314d 100644
--- a/test/612-jit-dex-cache/src-ex/LoadedByAppClassLoader.java
+++ b/test/612-jit-dex-cache/src-ex/LoadedByAppClassLoader.java
@@ -29,7 +29,7 @@
}
class OtherClass {
- public static Class getB() {
+ public static Class<?> getB() {
// This used to return the B class of another class loader.
return B.class;
}
diff --git a/test/612-jit-dex-cache/src/Main.java b/test/612-jit-dex-cache/src/Main.java
index 0e4bd22..89ebe09 100644
--- a/test/612-jit-dex-cache/src/Main.java
+++ b/test/612-jit-dex-cache/src/Main.java
@@ -41,7 +41,7 @@
public class Main {
- private static Class classFromDifferentLoader() throws Exception {
+ private static Class<?> classFromDifferentLoader() throws Exception {
final String DEX_FILE = System.getenv("DEX_LOCATION") + "/612-jit-dex-cache-ex.jar";
ClassLoader loader = new DelegateLastPathClassLoader(DEX_FILE, Main.class.getClassLoader());
return loader.loadClass("LoadedByAppClassLoader");
@@ -49,7 +49,7 @@
public static void main(String[] args) throws Exception {
System.loadLibrary(args[0]);
- Class cls = classFromDifferentLoader();
+ Class<?> cls = classFromDifferentLoader();
Method m = cls.getDeclaredMethod("letMeInlineYou", A.class);
B b = new B();
// Invoke the method enough times to get an inline cache and get JITted.
@@ -63,5 +63,5 @@
}
}
- public static native void ensureJitCompiled(Class cls, String method_name);
+ public static native void ensureJitCompiled(Class<?> cls, String method_name);
}
diff --git a/test/MyClassNatives/MyClassNatives.java b/test/MyClassNatives/MyClassNatives.java
index 19c13f7..4a8b0e0 100644
--- a/test/MyClassNatives/MyClassNatives.java
+++ b/test/MyClassNatives/MyClassNatives.java
@@ -35,11 +35,11 @@
static native int getText(long val1, Object obj1, long val2, Object obj2);
synchronized native Object []getSinkPropertiesNative(String path);
- native Class instanceMethodThatShouldReturnClass();
- static native Class staticMethodThatShouldReturnClass();
+ native Class<?> instanceMethodThatShouldReturnClass();
+ static native Class<?> staticMethodThatShouldReturnClass();
- native void instanceMethodThatShouldTakeClass(int i, Class c);
- static native void staticMethodThatShouldTakeClass(int i, Class c);
+ native void instanceMethodThatShouldTakeClass(int i, Class<?> c);
+ static native void staticMethodThatShouldTakeClass(int i, Class<?> c);
native float checkFloats(float f1, float f2);
native void forceStackParameters(int i1, int i2, int i3, int i4, int i5, int i6, int i8, int i9,