Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8175797 (ref) Reference::enqueue method should clear referent before enqueuing
  3. JDK-8176389

Release Note: java.lang.ref.Reference.enqueue method clears the reference object before enqueuing

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: P4
    • Resolution: Delivered
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Subcomponent:
    • Verification:
      Verified

      Description

      `java.lang.ref.Reference.enqueue` method clears the reference object before it is added to the registered queue. When the `enqueue` method is called, the referent is cleared and `get()` method will return null in JDK 9.

      Typically when a reference object is enqueued, it is expected that the referent is no longer referenced and is cleared explicitly via the `clear` method to avoid memory leak. In other words the `get` method is expected not to be called in common cases once the `enqueue`method is called. In the case when the `get` method from an enqueued reference object and existing code attempts to access members of the referent object, `NullPointerException` may be thrown. Such code will need to be updated.

        Attachments

          Activity

            People

            • Assignee:
              mchung Mandy Chung
              Reporter:
              mchung Mandy Chung
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: