Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8137055 Prepare for JEP 260
  3. JDK-8148117

Move sun.misc.Cleaner to jdk.internal.ref

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Fixed
    • P2
    • 9
    • 9
    • core-libs
    • b105

    Description

      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
      questionable.

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: