From de58ab2c03ff8112b07ab827c8fa38f670dfc656 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 5 Nov 2014 12:46:03 +0000 Subject: 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 --- test/401-optimizing-compiler/src/Main.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/401-optimizing-compiler/src/Main.java') 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; } -- cgit v1.2.3-59-g8ed1b