On Tue, 12 Dec 2023 15:29:46 GMT, Per Minborg <[email protected]> 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:
>
> Correct exception type in JavaDocs for SA:allocateFrom
Marked as reviewed by mcimadamore (Reviewer).
src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 397:
> 395: * @throws IndexOutOfBoundsException if {@code sourceOffset >
> source.byteSize() - (elementCount * sourceElementLayout.byteSize())}
> 396: * @throws IndexOutOfBoundsException if {@code sourceOffset < 0}
> 397: * @throws IllegalArgumentException if {@code elementCount < 0}
Please move this closer to the other IAE
-------------
PR Review: https://git.openjdk.org/jdk/pull/17079#pullrequestreview-1777819153
PR Review Comment: https://git.openjdk.org/jdk/pull/17079#discussion_r1424195197