On Thu, 20 Nov 2025 15:55:30 GMT, Jorn Vernee <[email protected]> wrote:
>> src/java.base/share/classes/jdk/internal/foreign/StringSupport.java line 68:
>>
>>> 66: @ForceInline
>>> 67: public static String readBytes(AbstractMemorySegmentImpl segment,
>>> long offset, Charset charset, long length) {
>>> 68: final int lengthBytes = (int) length;
>>
>> I think we should do something more here than just ignore the upper bits. We
>> probably need to throw an exception when the value is > Integer.MAX_VALUE
>
> Looks like we are already specified to throw IAE if 'the size of the string
> is greater than the largest string supported by the platform'
Done, and I added a test to cover the IAE
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28043#discussion_r2549317693