don't abort when compiling an array lookup with a constant negative index

Instead, just compile it as a direct call to the thunk which throws an
ArrayIndexOutOfBoundsException.
This commit is contained in:
Joel Dice
2010-09-25 15:48:15 -06:00
parent ebc54c234f
commit e75b57a127
2 changed files with 34 additions and 17 deletions

View File

@ -15,6 +15,17 @@ public class Arrays {
expect(exception != null);
}
{ int[] array = new int[0];
Exception exception = null;
try {
int x = array[-1];
} catch (ArrayIndexOutOfBoundsException e) {
exception = e;
}
expect(exception != null);
}
{ int[] array = new int[3];
int i = 0;
array[i++] = 1;