RFR: 8321786: SegmentAllocator:allocateFrom(ValueLayout, MemorySegment, ValueLayout, long, long) spec mismatch in exception scenario [v7]
Andrey Turbanov
aturbanov at openjdk.org
Wed Dec 20 10:40:53 UTC 2023
On Tue, 12 Dec 2023 15:45:47 GMT, Per Minborg <pminborg at 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
More information about the core-libs-dev
mailing list