Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8291065 Creating a VarHandle for a static field triggers class initialization
  3. JDK-8311878

Release Note: `MethodHandles.Lookup::findStaticVarHandle` Does Not Eagerly Initialize the Field's Declaring Class

    XMLWordPrintable

Details

    Description

      In the previous releases, `MethodHandles.Lookup::findStaticVarHandle` eagerly initializes the declaring class of the static field when the `VarHandle` is created. As specified in the specification, the declaring class should be initialized when the `VarHandle` is operated on if it has not already been initialized. This issue is fixed in this release. The declaring class is no longer eagerly initialized when `MethodHandles.Lookup::findStaticVarHandle` is called. Existing code that relies on the previous behavior may observe a change of the order of the classes being initialized.

      Attachments

        Activity

          People

            liach Chen Liang
            liach Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: