RFR: 8369564: Provide a MemorySegment API to read strings with known lengths [v16]
Liam Miller-Cushon
cushon at openjdk.org
Sun Jan 11 14:09:18 UTC 2026
On Sun, 11 Jan 2026 07:39:16 GMT, Hannes Greule <hgreule at openjdk.org> wrote:
>> Liam Miller-Cushon has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 21 additional commits since the last revision:
>>
>> - Merge branch 'master' into JDK-8369564
>> - Rename the parameter of getString from length to byteLength
>> - Merge branch 'master' into JDK-8369564
>> - Review feedback
>> - Update discussion of truncated reads of strings containing \0
>> - Return the number of copied bytes
>> - More javadoc updates
>> - Use Utils.checkNonNegativeArgument
>> - Review feedback
>>
>> * handle numChars + srcIndex overflow, and add tests
>> * replace yen with a character that round trips
>> - Improve test coverage, and more fixes
>> - ... and 11 more: https://git.openjdk.org/jdk/compare/d3fa70cc...e2cc6f0b
>
> src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 1351:
>
>> 1349: * largest string supported by the platform
>> 1350: * @throws IndexOutOfBoundsException if {@code offset < 0}
>> 1351: * @throws IndexOutOfBoundsException if {@code offset > byteSize() - length}
>
> Suggestion:
>
> * @throws IndexOutOfBoundsException if {@code offset > byteSize() - byteLength}
>
> I assume this was missed?
Thanks, fixed
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28043#discussion_r2679577283
More information about the core-libs-dev
mailing list