RFR: 8319820: Use unnamed variables in the FFM implementation

Andrey Turbanov aturbanov at openjdk.org
Mon Nov 13 08:08:58 UTC 2023


On Fri, 10 Nov 2023 07:19:42 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> This PR proposes to use unnamed variables now that they have become available in Java.
> 
> There is also a cosmetic cleanup making a switch rake smaller and where variables are pre-calculated rather than spreading expressions around.

src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 570:

> 568:                 case int[]    _ -> new HeapMemorySegmentImpl.OfInt(off, base, len, readOnly, bufferScope);
> 569:                 case float[]  _ -> new HeapMemorySegmentImpl.OfFloat(off, base, len, readOnly, bufferScope);
> 570:                 case long[]   _ ->  new HeapMemorySegmentImpl.OfLong(off, base, len, readOnly, bufferScope);

Suggestion:

                case long[]   _ -> new HeapMemorySegmentImpl.OfLong(off, base, len, readOnly, bufferScope);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16594#discussion_r1390729188


More information about the core-libs-dev mailing list