On Wed, 3 May 2023 08:31:34 GMT, Maurizio Cimadamore <[email protected]>
wrote:
> This patch adds documentation for the behavior of the
> `MemoryLayout::structLayout` factory.
>
> This factory throws an `IllegalArgumentException` if one of the member
> layouts passed to it occurs at an offset within the struct that is not
> aligned.
>
> As part of this patch, I've also added some api notes on how to use this
> factory when unaligned elements are present.
Nice api note!
src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 743:
> 741: * overflows.
> 742: * @throws IllegalArgumentException if a member layouts in {@code
> elements} occurs at an offset (relative to the start
> 743: * of the struct layout) which is not compatible with its alignment
> constraint.
Suggestion:
* @throws IllegalArgumentException if a member layout in {@code elements}
occurs at an offset (relative to the start
* of the struct layout) which is not compatible with its alignment
constraint.
-------------
Marked as reviewed by jvernee (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/13770#pullrequestreview-1411008792
PR Review Comment: https://git.openjdk.org/jdk/pull/13770#discussion_r1183756362