• Type: Sub-task
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Resolved In Build:


      sun.misc.Cleaner was previously listed as a critical internal API in JEP 260, JDK-8132928, but on further investigation
      it has been moved to an open issue, for the following reasons:
        1) its primary use in the JDK is within NIO direct buffers to release native memory. The base module cannot have a
           dependency on the jdk.unsupported module so will need to be updated to use an alternative cleaner,
        2) the usage of Cleaner outside the JDK, as determined by corpus analysis, has largely been observed to hack into
           private fields of the internal NIO direct buffer classes to explicitly release native memory.

      As stated in 1), the type of the cleaner used by NIO direct buffers will have to change. Given this, and the fact that JDK 9
      has a new general purposed cleaner API, java.lang.ref.Cleaner, JDK-8138696, the value of keep sun.misc.Cleaner is

      This issue proposes to simply move Cleaner into an internal non-exported package in the base module so that it can be
      used by the NIO direct buffers classes, and small number of other places.

      If, at some point in the future, it is determined that sun.misc.Cleaner is in fact a critical internal API ( with static usage ),
      then it can be reinstated as a subtype of jdk.internal.ref.Cleaner, providing the same public API.

      Note: some popular open source libraries that hack into the internal private cleaner field of direct buffers will have to
      have their code updated, if they wish to continue to do this.


          Issue Links



              • Assignee:
                chegar Chris Hegarty
                chegar Chris Hegarty
              • Votes:
                0 Vote for this issue
                2 Start watching this issue


                • Created: