Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8304458

Remove java.lang.Compiler

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 21
    • core-libs
    • None
    • source, binary, behavioral
    • low
    • The class has been non-functional in Hotspot for two decades and was terminally deprecated in Java 9. The code seems to still have a native implementation in OpenJ9.
    • Java API
    • SE

    Description

      Summary

      The class java.lang.Compiler has been non-functional for a long time. It was terminally deprecated in Java 9. Time has come to remove it.

      Problem

      JDK-4285505 summarizes the problem like this:

      The class java.lang.Compiler supposedly provides a high level reflective interface to the underlying JIT. This interface is effectively ignored by Hotspot, and by many other implementations.

      We have long ago abandoned efforts for a standaradized JIT interface. JITs and their technologies vary too widely. At the user level, it is unclear why control of a quality-of-implementation factor like a JIT needs to be available in a portable form.

      The @deprecated notice in the Javadocs of the class states:

      JIT compilers and their technologies vary too widely to be controlled effectively by a standardized interface. As such, many JIT compiler implementations ignore this interface, and are instead controllable by implementation-specific mechanisms such as command-line options. This class is subject to removal in a future version of Java SE.

      A search in a large corpus of Java code indicates that the class is very rarely used:

      A search of 3M classes in 130k artifacts found just 8 references to this class. 6 of the 8 are versions of the same thing seem to be an off-label usage in a class named net.openhft.chronicle.core.Jvm where it calls Compiler.enable() instead of Thread.onSpinWait on older JDK releases.

      Solution

      Remove the class java.lang.Compiler. This class has no use or references within OpenJDK.

      Specification

      Remove the following class:

      java.lang.Compiler

      Attachments

        Issue Links

          Activity

            People

              eirbjo Eirik Bjørsnøs
              eirbjo Eirik Bjørsnøs
              Alan Bateman, David Holmes, Iris Clark
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: