The compact strings implementation of java.lang.String in StringUTF16.newBytesFor checks the length of non-latin1 strings against MAX_LENGTH.
The exception message says "should be less than" is correct but does not match the code.
If the length is exactly MAX_LENGTH the array cannot be allocated, throwing java.lang.OutOfMemoryError: Requested array size exceeds VM limit
The exception message says "should be less than" is correct but does not match the code.
If the length is exactly MAX_LENGTH the array cannot be allocated, throwing java.lang.OutOfMemoryError: Requested array size exceeds VM limit
- relates to
-
JDK-8311906 Improve robustness of String constructors with mutable array inputs
-
- Closed
-
-
JDK-8322018 Test java/lang/String/CompactString/MaxSizeUTF16String.java fails with -Xcomp
-
- Resolved
-
- links to
-
Commit openjdk/jdk/4fb5c128
-
Review(master) openjdk/jdk/17008