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

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

XMLWordPrintable

    • Verified

        `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 reference object is cleared and `get()` method will return null in JDK 9.

        Typically when a reference object is enqueued, it is expected that the reference object is cleared explicitly via the `clear` method to avoid memory leak because its referent is no longer referenced. 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, `NullPointerException` may be thrown. Such code will need to be updated.

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

                Created:
                Updated:
                Resolved: