[foreign-memaccess+abi] RFR: 8296417: Make memory session a pure lifetime abstraction [v6]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Nov 7 13:12:36 UTC 2022


On Mon, 7 Nov 2022 09:24:55 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix SegmentAllocator.slicingAllocator to throw IIOBE
>
> src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 354:
> 
>> 352:      * <p>
>> 353:      * When the returned allocator cannot satisfy an allocation request, e.g. because a slice of the provided
>> 354:      * segment with the requested size cannot be found, an {@link IndexOutOfBoundsException} is thrown.
> 
> This type of exception appears a bit strange to me.

Given that the implementation of this method is based on `MemorySegment::asSlice`, I think the exception type is not too bad.

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

PR: https://git.openjdk.org/panama-foreign/pull/750


More information about the panama-dev mailing list