RFR: 8321786: SegmentAllocator:allocateFrom(ValueLayout, MemorySegment, ValueLayout, long, long) spec mismatch in exception scenario [v4]

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Dec 12 14:13:33 UTC 2023


On Tue, 12 Dec 2023 14:01:49 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Revert change in allocateNoInit
>
> src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 595:
> 
>> 593:                             long elementCount) {
>> 594: 
>> 595:         Utils.checkNonNegativeIndex(srcOffset, "srcOffset");
> 
> These new checks don't change the behavior, right? E.g. they will end up issuing an IIOBE, as before? So, why the changes? (note that these change might lead to double checks)

It seems like this is about generating better exception (while leaving the exception type unchanged). If so, I support the change, as I agree that this patch does improve some of the messages.

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

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


More information about the core-libs-dev mailing list