summaryrefslogtreecommitdiff
path: root/test/518-null-array-get/src
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2017-12-07 01:05:02 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-12-07 01:05:02 +0000
commit7869c87348dffba5bd5ef39f7fe74689bc19ae3c (patch)
tree4e7ff8aa8daccf308fa4e0bd6e4dc001805d855b /test/518-null-array-get/src
parent92ab698e46dba3b6cff1457f47bfc344cb03f7ec (diff)
parent52f205a38bda70d5c63907ef354a1475b4237b21 (diff)
Merge "ART: Remove old aget on null workaround"
Diffstat (limited to 'test/518-null-array-get/src')
-rw-r--r--test/518-null-array-get/src/Main.java36
1 files changed, 28 insertions, 8 deletions
diff --git a/test/518-null-array-get/src/Main.java b/test/518-null-array-get/src/Main.java
index 66e50aacd7..678aef1f43 100644
--- a/test/518-null-array-get/src/Main.java
+++ b/test/518-null-array-get/src/Main.java
@@ -22,16 +22,36 @@ public class Main {
class InnerClass {}
public static void main(String[] args) throws Exception {
- Class<?> c = Class.forName("NullArray");
- Method m = c.getMethod("method");
- Object[] arguments = { };
+ checkLoad("NullArrayFailInt2Object", true);
+ checkLoad("NullArrayFailObject2Int", true);
+ checkLoad("NullArraySuccessInt", false);
+ checkLoad("NullArraySuccessInt2Float", false);
+ checkLoad("NullArraySuccessShort", false);
+ checkLoad("NullArraySuccessRef", false);
+ }
+
+ private static void checkLoad(String className, boolean expectError) throws Exception {
+ Class<?> c;
try {
- m.invoke(null, arguments);
- throw new Error("Expected an InvocationTargetException");
- } catch (InvocationTargetException e) {
- if (!(e.getCause() instanceof NullPointerException)) {
- throw new Error("Expected a NullPointerException");
+ c = Class.forName(className);
+ if (expectError) {
+ throw new RuntimeException("Expected error for " + className);
+ }
+ Method m = c.getMethod("method");
+ try {
+ m.invoke(null);
+ throw new RuntimeException("Expected an InvocationTargetException");
+ } catch (InvocationTargetException e) {
+ if (!(e.getCause() instanceof NullPointerException)) {
+ throw new RuntimeException("Expected a NullPointerException");
+ }
+ System.out.println(className);
+ }
+ } catch (VerifyError e) {
+ if (!expectError) {
+ throw new RuntimeException(e);
}
+ System.out.println(className);
}
}
}