RFR: 8325949: Create an internal utility method for creating VarHandle instances [v2]

Per Minborg pminborg at openjdk.org
Fri Sep 13 14:46:09 UTC 2024


On Fri, 13 Sep 2024 12:40:33 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Rename and reformat
>
> src/java.base/share/classes/jdk/internal/reflect/MethodHandlesInternal.java line 50:
> 
>> 48:     private MethodHandlesInternal() {}
>> 49: 
>> 50:     public static VarHandle findVarHandle(MethodHandles.Lookup lookup,
> 
> Do you think we should create a 3-arg overload like `Lookup lookup, String name, Class<?> type` that calls `findVarHandle(lookup, lookup.lookupClass(), name, type);` for ease of use at many call sites?

The pro: Simpler code at the call site. The con: it is a bit magic.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20972#discussion_r1758999490


More information about the nio-dev mailing list