On Tue, 12 Dec 2023 15:09:45 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:
> 
>   Update after comments

src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 394:

> 392:      * @throws WrongThreadException if this method is called from a 
> thread {@code T},
> 393:      *         such that {@code source.isAccessibleBy(T) == false}
> 394:      * @throws IllegalArgumentException if {@code elementCount * 
> sourceElementLayout.byteSize()} overflows

if `elementCount < 0` -> IAE, as per allocate(layout, size)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17079#discussion_r1424158822

Reply via email to