On Tue, 6 May 2025 08:47:54 GMT, Shaojin Wen <s...@openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with three additional 
>> commits since the last revision:
>> 
>>  - Fix empty line at the end of a third file
>>  - Fix empty line at the end of another file
>>  - Fix empty line at the end of a file
>
> src/java.base/share/classes/jdk/internal/foreign/CaptureStateUtil.java line 
> 390:
> 
>> 388:                 return MhUtil.findVirtual(LOOKUP, Arena.class, "close",
>> 389:                         MethodType.methodType(void.class));
>> 390:         }
> 
> Suggestion:
> 
>         return switch (index) {
>             case NON_NEGATIVE_INT -> MhUtil.findStatic(LOOKUP, "nonNegative",
>                     MethodType.methodType(boolean.class, int.class));
>             case SUCCESS_INT -> MhUtil.findStatic(LOOKUP, "success",
>                     MethodType.methodType(int.class, int.class, 
> MemorySegment.class));
>             case ERROR_INT -> MhUtil.findStatic(LOOKUP, "error",
>                     MethodType.methodType(int.class, MethodHandle.class, 
> int.class, MemorySegment.class));
>             case NON_NEGATIVE_LONG -> MhUtil.findStatic(LOOKUP, "nonNegative",
>                     MethodType.methodType(boolean.class, long.class));
>             case SUCCESS_LONG -> MhUtil.findStatic(LOOKUP, "success",
>                     MethodType.methodType(long.class, long.class, 
> MemorySegment.class));
>             case ERROR_LONG -> MhUtil.findStatic(LOOKUP, "error",
>                     MethodType.methodType(long.class, MethodHandle.class, 
> long.class, MemorySegment.class));
>             case ACQUIRE_ARENA -> MhUtil.findStatic(LOOKUP, "acquireArena",
>                     MethodType.methodType(Arena.class));
>             case ALLOCATE -> MhUtil.findStatic(LOOKUP, "allocate",
>                     MethodType.methodType(MemorySegment.class, Arena.class));
>             case ARENA_CLOSE -> MhUtil.findVirtual(LOOKUP, Arena.class, 
> "close",
>                     MethodType.methodType(void.class));
>             default -> throw new InternalError("Unknown index: " + index);
>         };
> 
> Switch statement can be replaced with enhanced 'switch'

I have the old switch format in anticipation of faster startup.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25043#discussion_r2075368639

Reply via email to