JDK-8071507 : (ref) Clear phantom reference as soft and weak references do
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2015-01-23
  • Updated: 2022-08-11
  • Resolved: 2015-12-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9 Other
8u351Fixed 9 b103Fixed openjdk8u352Fixed
Related Reports
Blocks :  
CSR :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8173071 :  
Description
Soft and weak references are automatically-cleared references (i.e. these references are cleared by the collector before it's enqueued) whereas phantom reference is not an automatically-cleared reference.  Instead, the get method of a phantom reference always returns null to ensure that the referent of a phantom reference may not be retrieved.

This proposes to make phantom references automatically-cleared reference as soft and weak references do.

Comments
Some minor issues raised on the PR. Please address these before 8u approval.
05-08-2022

JDK 8u Fix Request: This fix is required for compliance with Java SE 8 Maintenance Release 4: https://jcp.org/en/jsr/detail?id=337
04-08-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk8u-dev/pull/94 Date: 2022-08-01 16:30:17 +0000
01-08-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk8u-ri/pull/4 Date: 2022-04-19 18:01:20 +0000
19-04-2022

URL: http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/107dae30be84 User: lana Date: 2016-01-27 21:42:23 +0000
27-01-2016

URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/42ccdfe56796 User: lana Date: 2016-01-27 21:42:04 +0000
27-01-2016

URL: http://hg.openjdk.java.net/jdk9/hs-rt/jdk/rev/42ccdfe56796 User: kbarrett Date: 2015-12-28 20:45:47 +0000
28-12-2015

URL: http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/107dae30be84 User: kbarrett Date: 2015-12-28 20:45:45 +0000
28-12-2015