diff options
| author | 2018-10-31 15:11:59 +0000 | |
|---|---|---|
| committer | 2018-10-31 15:11:59 +0000 | |
| commit | 5e43d5f7323209b8cb1f3a373bdda17d2a53694e (patch) | |
| tree | 7069ed88816c55b9b38ec0fad5308b704ecb8f46 /test/174-escaping-instance-of-bad-class/src/Main.java | |
| parent | 2947ba6f1a14d7ea30aa60c3032fa07585cce1b4 (diff) | |
| parent | 7f260d43e9b440f934270873c1e03eb867fa2873 (diff) | |
Merge "Fix and improve ClinitCheck elimination."
Diffstat (limited to 'test/174-escaping-instance-of-bad-class/src/Main.java')
| -rw-r--r-- | test/174-escaping-instance-of-bad-class/src/Main.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/174-escaping-instance-of-bad-class/src/Main.java b/test/174-escaping-instance-of-bad-class/src/Main.java index 4346152f6c..4f66a31837 100644 --- a/test/174-escaping-instance-of-bad-class/src/Main.java +++ b/test/174-escaping-instance-of-bad-class/src/Main.java @@ -39,6 +39,17 @@ public class Main { ncdfe.printStackTrace(); } } + // Call bar() on the escaped instance of Bad. + try { + bad.bar(); + } catch (NoClassDefFoundError ncdfe) { + // On RI, the NCDFE has no cause. On ART, the badClinit is the cause. + if (ncdfe.getCause() == badClinit || ncdfe.getCause() == null) { + System.out.println("Caught NoClassDefFoundError."); + } else { + ncdfe.printStackTrace(); + } + } } public static void hierarchyTest() { @@ -117,9 +128,19 @@ class Bad { System.out.println("Bad.instanceValue = " + instanceValue); System.out.println("Bad.staticValue = " + staticValue); } + public void bar() { + System.out.println("Bad.bar()"); + System.out.println("Bad.staticValue [indirect] = " + Helper.$inline$getBadStaticValue()); + } public Bad(int iv) { instanceValue = iv; } public int instanceValue; public static int staticValue; + + public static class Helper { + public static int $inline$getBadStaticValue() { + return Bad.staticValue; + } + } } class BadSuper { |