On Thu, 15 Jan 2026 17:51:57 GMT, Liam Miller-Cushon <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/String.java line 1498:
>>
>>> 1496: if (length > (long)Integer.MAX_VALUE) {
>>> 1497: throw new IllegalStateException("Required length
>>> exceeds implementation limit");
>>> 1498: }
>>
>> This is more like a should never reach here; the OOME thrown by
>> encodedLengthUTF8_UTF16 should ocur.
>> IllegalStateException usually refers to a programming error.
>> The other occurrence like this throws OOME.
>
> Thanks, what do you think about refactoring the OOME into
> `encodedLengthUTF8_UTF16` and having it return `int`?
That's fine, the `long` return was to simplify handling of too large returns.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28454#discussion_r2695831889