JEP 254: Compact Strings - length limits

Tim Ellison t.p.ellison at
Tue Sep 6 17:09:38 UTC 2016

Has it been noted that while JEP 254 reduces the space occupied by one
byte per character strings, moving from a char[] to byte[]
representation universally means that the maximum length of a UTF-16
(two bytes per char) string is now halved?

Since the goal is "preserving full compatibility", this has been missed
by failing to allow for UTF-16 strings of length greater than
Integer.MAX_VALUE / 2.


More information about the core-libs-dev mailing list