RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v14]

Chen Liang liach at openjdk.org
Wed Jun 28 00:13:51 UTC 2023


On Tue, 27 Jun 2023 23:33:57 GMT, Chen Liang <liach at openjdk.org> wrote:

>> test/jdk/java/lang/invoke/VarHandles/LazyInitializingTest.java line 85:
>> 
>>> 83: 
>>> 84:     @Test
>>> 85:     public void testInitializationOnVarHandleUse() {
>> 
>> I think we will need to expand this to also test operating on a MH to a VH, an indirect VH, and on a MH to indirect VH. We could do this separately.
>
> The MH on VH case is worth considering; the indirect VH cases are already covered by `-Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true`.

Done; added a test case to test initialization on toMethodHandle use in latest push, passed locally.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1244504070


More information about the core-libs-dev mailing list