Support for exceptions from array allocation.
Adds support for exceptions during array allocation and checked array
allocation (used by filled-new-array). Adds more unit tests.
Change-Id: I3438b257a1cf19538d8b72529097a74347ac3b99
diff --git a/test/IntMath/IntMath.java b/test/IntMath/IntMath.java
index b1b7312..7b0d5f8 100644
--- a/test/IntMath/IntMath.java
+++ b/test/IntMath/IntMath.java
@@ -833,6 +833,23 @@
}
}
+ static int testArrayAllocation() {
+ int res = 0;
+ try {
+ int[] x = new int[-1];
+ res += 1;
+ } catch (NegativeArraySizeException e) {
+ res += 2;
+ }
+ try {
+ int[] x = new int [1];
+ res += 10;
+ } catch (Throwable e) {
+ res += 20;
+ }
+ return res;
+ }
+
public static void main(String[] args) {
boolean failure = false;
int res;
@@ -1010,6 +1027,14 @@
failure = true;
}
+ res = testArrayAllocation();
+ if (res == 12) {
+ System.out.println("testArrayAllocation PASSED");
+ } else {
+ System.out.println("testArrayAllocation FAILED: " + res);
+ failure = true;
+ }
+
res = manyArgs(0, 1L, 2, 3L, 4, 5L, 6, 7, 8.0, 9.0f, 10.0,
(short)11, 12, (char)13, 14, 15, (byte)-16, true, 18,
19, 20L, 21L, 22, 23, 24, 25, 26);