ADDITIONAL SYSTEM INFORMATION :
openjdk version "11-ea" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11-ea+26)
OpenJDK 64-Bit Server VM 18.9 (build 11-ea+26, mixed mode)
A DESCRIPTION OF THE PROBLEM :
When creating an extremely large LinkedList in JShell, a NullPointerException is thrown
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
launch jshell:
jshell -R-Xmx9G
run the command:
IntStream.rangeClosed(0, Integer.MAX_VALUE).mapToObj(i -> (byte) 0).collect(Collectors.toCollection(LinkedList::new))
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
either no exception occurs, or an OutOfMemoryError is reported
ACTUAL -
a NullPointerException occurs