RFR: 8321786: SegmentAllocator:allocateFrom(ValueLayout, MemorySegment, ValueLayout, long, long) spec mismatch in exception scenario [v4]
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Dec 12 13:55:33 UTC 2023
On Tue, 12 Dec 2023 13:23:27 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:
>
> Revert change in allocateNoInit
src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 2380:
> 2378: * @throws IndexOutOfBoundsException if {@code index * layout.byteSize()} overflows
> 2379: * @throws IndexOutOfBoundsException if {@code index * layout.byteSize() > byteSize() - layout.byteSize()}
> 2380: * or {@code offset < 0}
All these should say `index` not `offset`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17079#discussion_r1424024406
More information about the core-libs-dev
mailing list