On Tue, 12 Dec 2023 15:45:47 GMT, Per Minborg <pminb...@openjdk.org> wrote:

>> This PR proposes to change the specification for some methods that take 
>> `long` offsets so that they will throw an `IllegalArgumentException` rather 
>> than an `IndexOutOfBoundsException` for negative values.
>> 
>> The PR also proposes to fix a bug where the allocation size would overflow 
>> and the specified exception was not thrown.
>
> Per Minborg has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Move @throws tag

test/jdk/java/foreign/TestSegmentCopy.java line 183:

> 181:         byte[] dst = new byte[] {1, 2, 3, 4};
> 182:         assertThrows(IndexOutOfBoundsException.class, () ->
> 183:                 MemorySegment.copy(src, JAVA_BYTE, -1, dst,0, 4)

Suggestion:

                MemorySegment.copy(src, JAVA_BYTE, -1, dst, 0, 4)

test/jdk/java/foreign/TestSegmentCopy.java line 186:

> 184:         );
> 185:         assertThrows(IndexOutOfBoundsException.class, () ->
> 186:                 MemorySegment.copy(src, JAVA_BYTE, 0, dst,-1, 4)

Suggestion:

                MemorySegment.copy(src, JAVA_BYTE, 0, dst, -1, 4)

test/jdk/java/foreign/TestSegmentCopy.java line 189:

> 187:         );
> 188:         assertThrows(IndexOutOfBoundsException.class, () ->
> 189:                 MemorySegment.copy(src, JAVA_BYTE, 0, dst,0, -1)

Suggestion:

                MemorySegment.copy(src, JAVA_BYTE, 0, dst, 0, -1)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17079#discussion_r1432545779
PR Review Comment: https://git.openjdk.org/jdk/pull/17079#discussion_r1432546057
PR Review Comment: https://git.openjdk.org/jdk/pull/17079#discussion_r1432546260

Reply via email to