[foreign-memaccess+abi] RFR: Simplify ValueLayouts

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Feb 16 10:05:45 UTC 2023


On Thu, 16 Feb 2023 09:43:47 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/foreign/layout/ValueLayouts.java line 145:
>> 
>>> 143: 
>>> 144:         @Override
>>> 145:         final V dup(long bitAlignment, Optional<String> name) {
>> 
>> question: instead of using a duplicator object, can't we have a new `dup` overload here with the required arguments, rewire the old `dup` to the new one, and then override as appropriate in all the subclasses? That would still allow you to define `withOrder` in a single place (which, AFAICS appears to be the main simplification?)
>
>> question: instead of using a duplicator object, can't we have a new `dup` overload here with the required arguments, rewire the old `dup` to the new one, and then override as appropriate in all the subclasses? That would still allow you to define `withOrder` in a single place (which, AFAICS appears to be the main simplification?)
> 
> This is exactly what I am proposing as an alternative in the PR header and perhaps that is easier to read. I will update the proposal accordingly.

Sorry - I did miss that comment.

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

PR: https://git.openjdk.org/panama-foreign/pull/798


More information about the panama-dev mailing list