Skip to content

Instantly share code, notes, and snippets.

@cancerberoSgx
Created February 6, 2013 19:55
Show Gist options
  • Save cancerberoSgx/4725277 to your computer and use it in GitHub Desktop.
Save cancerberoSgx/4725277 to your computer and use it in GitHub Desktop.
a "negative" bug - Arrays.fill() is not throwing expected index exceptions IllegalArgumentException and ArrayIndexOutOfBoundsException - in this example with boolean, but fails with all types:
boolean[] b3 = new boolean[2];
try {
Arrays.fill(b3, 2, 1, false);
Window.alert("error 1 - IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
}
try {
Arrays.fill(b3, -1, 1, false);
Window.alert("error 1 - ArrayIndexOutOfBoundsException expected");
} catch (ArrayIndexOutOfBoundsException e) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment