On Tue, 21 Mar 2023 09:02:29 GMT, Per Minborg <pminb...@openjdk.org> wrote:

>> API changes for the FFM API (third preview)
>> 
>> Specdiff:
>> https://cr.openjdk.org/~pminborg/panama/21/v1/specdiff/overview-summary.html
>> 
>> Javadoc:
>> https://cr.openjdk.org/~pminborg/panama/21/v1/javadoc/java.base/module-summary.html
>
> Per Minborg has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Add example for Option::captureStateLayout

src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 694:

> 692:      * @param bitSize the padding size in bits.
> 693:      * @return the new selector layout.
> 694:      * @throws IllegalArgumentException if {@code bitSize < 0} or {@code 
> bitSize % 8 != 0}

I'm not sure if this change in the `@throws` was deliberate - e.g. the new API 
seems to allow creation of padding layouts of zero size (which I did not 
realize). This can hide issues for code generators (e.g. I stumbled upon this 
when working on jextract, which was silently emitting zero-length paddings in 
some struct layouts). Perhaps better to revert to old semantics?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13079#discussion_r1144680066

Reply via email to