JDK-8149925 : We don't need jdk.internal.ref.Cleaner any more - part 1
  • Type: Task
  • Component: core-libs
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-02-16
  • Updated: 2016-03-23
  • Resolved: 2016-03-09
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 9
9 b110Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
sun.misc.Cleaner has been moved to internal package jdk.internal.ref recently [1] to clean-up sun.misc namespace. But now that:

- we have comparable public API (java.lang.ref.Cleaner & Cleanable) [2]
- we have an internal shared java.lang.ref.Cleaner instance (jdk.internal.ref.CleanerFactory.cleaner())
- sun.misc.Cleaner is not a special kind of Reference any more in the JVM [3]
- threads failing to allocate memory in NIO themselves get involved in cleaning, see JDK-6857566 

...I think there's no reason to keep this special internal API any more. It can be replaced with public API.

I propose to remove jdk.internal.ref.Cleaner class and replace its usages with java.lang.ref.Cleaner and friends [4].

[1] https://bugs.openjdk.java.net/browse/JDK-8148117
[2] https://bugs.openjdk.java.net/browse/JDK-8138696
[3] https://bugs.openjdk.java.net/browse/JDK-8143847
[4] http://cr.openjdk.java.net/~plevart/jdk9-dev/removeInternalCleaner/webrev.03/