On Tue, 11 Aug 2026 06:57:20 GMT, Volkan Yazici <[email protected]> wrote:

>> Liam Miller-Cushon has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Review feedback
>
> src/java.base/share/classes/java/lang/String.java line 2201:
> 
>> 2199:     int copyToSegmentRaw(MemorySegment segment, long offset, int 
>> srcIndex, int numChars) {
>> 2200:         Objects.requireNonNull(segment);
>> 2201:         Objects.checkFromIndexSize(srcIndex, numChars, length());
> 
> Any particular reason for skipping to validate the `offset`?

`offset` is validated by `MemorySegment.copy`, the other callers I see are 
generally just relying on it to validate its arguments. For `srcIndex` / 
`numChars` I think there's more of a benefit to validating before converting 
from characters to bytes.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/32268#discussion_r3755945125

Reply via email to