Fix verifier bug caused by confusing ArtMethod::IsDirect vs ArtMethod::IsStatic semantics.
Bug: 18485243
Change-Id: I011872446490628b51fb38a353abd1d499cc1290
diff --git a/test/118-noimage-dex2oat/src/Main.java b/test/118-noimage-dex2oat/src/Main.java
index c83b84d..9bf5bb3 100644
--- a/test/118-noimage-dex2oat/src/Main.java
+++ b/test/118-noimage-dex2oat/src/Main.java
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Main {
@@ -36,6 +37,8 @@
} else if (!hasImage && isBootClassPathOnDisk) {
throw new Error("Image with dex2oat enabled runs without an image file");
}
+
+ testB18485243();
}
static {
@@ -67,4 +70,19 @@
return (boolean) isBootClassPathOnDiskMethod.invoke(null, instructionSet);
}
}
+
+ private static void testB18485243() throws Exception {
+ Class<?> k = Class.forName("B18485243");
+ Object o = k.newInstance();
+ Method m = k.getDeclaredMethod("run");
+ try {
+ m.invoke(o);
+ } catch (InvocationTargetException e) {
+ Throwable actual = e.getTargetException();
+ if (!(actual instanceof IncompatibleClassChangeError)) {
+ throw new AssertionError("Expected IncompatibleClassChangeError", actual);
+ }
+ }
+ System.out.println("testB18485243 PASS");
+ }
}