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

remove the java.compiler system property

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P3
    • 21
    • core-libs
    • None
    • behavioral
    • low
    • Hide
      Running with -Djava.compiler or -Djava.compiler=NONE, and without -Xdebug, is the equivalent of -Xint today. It seems unlikely that there are many deployments that really want to run interpreter-only mode. If there are deployments setting -Djava.compiler like this then the options may be left overs from command lines copied from older documentation that pre-dates the full-speed debugging support in JDK 1.4. The proposed warning will help clean up these command line usages. The compatibility risk of the change is low. If someone really wants to run with the interpreter then they can run with -Xint.
      Show
      Running with -Djava.compiler or -Djava.compiler=NONE, and without -Xdebug, is the equivalent of -Xint today. It seems unlikely that there are many deployments that really want to run interpreter-only mode. If there are deployments setting -Djava.compiler like this then the options may be left overs from command lines copied from older documentation that pre-dates the full-speed debugging support in JDK 1.4. The proposed warning will help clean up these command line usages. The compatibility risk of the change is low. If someone really wants to run with the interpreter then they can run with -Xint.
    • System or security property
    • SE

    Description

      Summary

      Remove references and support for the java.compiler system property.

      Problem

      java.lang.Compiler was an interface which was supposed to provide a common abstraction for the underlying JIT implementation. However, given the wide variation of the underlying JIT implementations, this interface was never implemented or supported by the underlying JIT implementations. As such, this interface was deprecated for removal in Java 9 https://bugs.openjdk.org/browse/JDK-4285505. Recently, this interface has now been completely removed https://bugs.openjdk.org/browse/JDK-8205129.

      The java.lang.Compiler has a corresponding underspecified java.compiler system property. This is one of the system properties listed in the API documentation of System.getProperties() and the description of this property states - "Name of JIT compiler to use".

      Since the java.lang.Compiler interface was never implemented or supported by JIT implementations, there never was a specified set of values for this java.compiler system property. In hotspot implementation, the only exception to this were the values NONE and empty string. If this system property was set to a value of NONE or was set as empty string and if -Xdebug option wasn't specified while launching java, then the hotspot implementation would consider this as an instruction to run the application in interpreted-only mode. This would be equivalent to launching the application with the hotspot implementation specific -Xint option.

      With the java.lang.Compiler interface now removed and the fact that this system property hasn't seen any practical use, removing this system property and its references would be a good idea.

      Solution

      • Remove the system property "java.compiler". This means removing the reference to this property from the table in java.lang.System.getProperties() API documentation and removing the hotspot implementation which had special treatment for the values NONE and empty string.

      • Change the hotspot implementation to log a warning message when it sees the use of this system property when launching java. We believe that removing the implementation in hotspot for NONE and empty string value for this property, when -Xdebug option isn't set, shouldn't cause major compatibility issue, because applications can regain interpreted-only mode by using the -Xint option instead.

      Specification

      diff --git a/src/java.base/share/classes/java/lang/System.java b/src/java.base/share/classes/java/lang/System.java
      index f15b5861670..3fd13f89289 100644
      --- a/src/java.base/share/classes/java/lang/System.java
      +++ b/src/java.base/share/classes/java/lang/System.java
      @@ -760,8 +760,6 @@ public final class System {
            *     <td>List of paths to search when loading libraries</td></tr>
            * <tr><th scope="row">{@systemProperty java.io.tmpdir}</th>
            *     <td>Default temp file path</td></tr>
      -     * <tr><th scope="row">{@systemProperty java.compiler}</th>
      -     *     <td>Name of JIT compiler to use</td></tr>
            * <tr><th scope="row">{@systemProperty os.name}</th>
            *     <td>Operating system name</td></tr>
            * <tr><th scope="row">{@systemProperty os.arch}</th>

      Launching java by passing -Djava.compiler will generate a warning message:

      java -Djava.compiler=bar  Foo.java
      OpenJDK 64-Bit Server VM warning: The java.compiler system property is obsolete and no longer supported.
      
      
      java -Djava.compiler=NONE  Foo.java
      OpenJDK 64-Bit Server VM warning: The java.compiler system property is obsolete and no longer supported, use -Xint

      Attachments

        Issue Links

          Activity

            People

              jpai Jaikiran Pai
              mduigou Mike Duigou
              Alan Bateman, David Holmes, Iris Clark, Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: