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 valuesNONE
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 forNONE
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
- csr of
-
JDK-8041676 remove the java.compiler system property
-
- Closed
-