Duplicate :
|
|
Relates :
|
|
Relates :
|
Originally reported at http://stackoverflow.com/questions/25942010/how-is-arrayoutofboundsexception-possible-in-string-valueofint The following test case crashes JVM when it should normally runs forever. public class EliminateAutoBoxCrash { private static final int[] values = new int[256]; public static void main(String[] args) { byte[] bytes = new byte[] {-1}; while (true) { for (Byte b : bytes) { values[b & 0xff]++; } } } } Note autoboxing: Byte b. Workaround: -XX:-EliminateAutoBox Initial investigation shows that the bug has been introduced with the fix for JDK-8042786.
|