[foreign-memaccess+abi] RFR: Clarify IllegalArgumentException on MemorySegment::[spliterator, elements]
Paul Sandoz
psandoz at openjdk.java.net
Tue Apr 27 01:10:46 UTC 2021
On Mon, 26 Apr 2021 22:59:10 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> In an offline discussion I was made aware that `MemorySegment.spliterator` was not specifying what happened if the size of the layout passed to spliterator() did not match that of the segment.
>
> The newly revised method has a better javadoc, which says a bit more, but stil doesn't specify what happens if the element layout is bigger than the segment.
>
> This small patch rectifies that, and add few tests to check that the implementation issues the expected exceptions.
src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java line 187:
> 185: * @param elementLayout the layout to be used for splitting.
> 186: * @return the element spliterator for this segment
> 187: * @throws IllegalArgumentException if this segment size is not a multiple of the size of {@code elementLayout},
"... if the elementLayout size is zero, or the segment size modulo the elementLayout size is greater than zero" ?
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/522
More information about the panama-dev
mailing list