RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout [v4]

Per Minborg pminborg at openjdk.org
Mon Sep 23 16:35:18 UTC 2024


On Mon, 23 Sep 2024 14:43:37 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/foreign/Linker.java line 265:
>> 
>>> 263:  *      its non-padding layout elements, or to satisfy (2), and</li>
>>> 264:  * <li>{@code G} is {@code G.memberLayouts().isEmpty()} or (at the same time) not all
>>> 265:  * elements are padding layouts.</li>
>> 
>> I suggest splitting the last list item into 2. The prior item also needs to be cleaned up (replace `, and` with `;`).
>> 
>> Not sure what you mean here with 'at the same time'? An empty group layout can not contain padding layouts.
>
> I think it might be enough to just mention that not only padding layouts are allowed. The list is for things that should all be true, so adding an 'or' condition in there seems a bit confusing.

My attempt with the "at the same time" was to emphasize that it is `and ... and (... or ..)` but maybe that is too hard to see. I initially had `and (not empty and not all are padding layout)` but used De Morgan's law. I've rewritten the docs now to something that is hopefully better.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21041#discussion_r1771764478


More information about the core-libs-dev mailing list