diff options
author | 2014-11-05 12:46:03 +0000 | |
---|---|---|
committer | 2014-11-06 16:49:52 +0000 | |
commit | de58ab2c03ff8112b07ab827c8fa38f670dfc656 (patch) | |
tree | c872bfbcad1e90845008140bbddcc43e56dc19d2 /test/401-optimizing-compiler/src/Main.java | |
parent | 3ed86e4e98dfe1b05c9a03aa2aee42c145a018c3 (diff) |
Implement try/catch/throw in optimizing.
- We currently don't run optimizations in the presence of a try/catch.
- We therefore implement Quick's mapping table.
- Also fix a missing null check on array-length.
Change-Id: I6917dfcb868e75c1cf6eff32b7cbb60b6cfbd68f
Diffstat (limited to 'test/401-optimizing-compiler/src/Main.java')
-rw-r--r-- | test/401-optimizing-compiler/src/Main.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/401-optimizing-compiler/src/Main.java b/test/401-optimizing-compiler/src/Main.java index 07c407b565..7c3fd25ea7 100644 --- a/test/401-optimizing-compiler/src/Main.java +++ b/test/401-optimizing-compiler/src/Main.java @@ -94,6 +94,14 @@ public class Main { exception = e; } + // Test that we do NPE checks on array length. + exception = null; + try { + $opt$ArrayLengthOfNull(null); + } catch (NullPointerException e) { + exception = e; + } + if (exception == null) { throw new Error("Missing NullPointerException"); } @@ -218,5 +226,9 @@ public class Main { return 42; } + public static int $opt$ArrayLengthOfNull(int[] array) { + return array.length; + } + Object o; } |