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

Chen Liang liach at openjdk.org
Thu Jun 29 01:55:30 UTC 2023


On Wed, 28 Jun 2023 23:08:28 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> I suggest to create a CSR to document the behavioral change to match the specification.

CSR filed for this behavior change; no spec updates but there's minor class-loading compatibility risk. I would be grateful if you can review the CSR.

> test/jdk/java/lang/invoke/VarHandles/LazyInitializingTest.java line 30:
> 
>> 28:  *          initialization mechanism..
>> 29:  * @run junit LazyInitializingTest
>> 30:  * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true LazyInitializingTest
> 
> I wonder if this new test should run with all combination of 
> `java.lang.invoke.VarHandle.VAR_HANDLE_GUARDS` and `java.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT` as done in other `VarHandleTestXXX`.

Done, now the test runs with all 4 combinations and passes on my end.

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

PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1612317158
PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1245997356


More information about the core-libs-dev mailing list