-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
11.0.1
-
x86_64
-
generic
ADDITIONAL SYSTEM INFORMATION :
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
A DESCRIPTION OF THE PROBLEM :
The sun.misc.{Signal,SignalHandler,Unsafe} classes that were retained in JEP 260 are not included in the compiler tree ct.sym library for releases earlier than 9. Code targeting 1.8 that uses sun.misc.{Signal,SignalHandler} will compile without issue with --release 9 but not when --release 8 or earlier is used. This issue appears to have existed since the --release flag was first introduced.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the following code snippet using --release 8
class Main {{ sun.misc.Signal.class.getName(); }}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
test/Main.java:1: warning: Signal is internal proprietary API and may be removed in a future release
package test; class Main {{ sun.misc.Signal.class.getName(); }}
^
1 warning
ACTUAL -
test/Main.java:1: error: package sun.misc does not exist
package test; class Main {{ sun.misc.Signal.class.getName(); }}
^
1 error
---------- BEGIN SOURCE ----------
package test; class Main {{ sun.misc.Signal.class.getName(); }}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Build using a real JDK 1.8 toolchain or targeting Java 9+
FREQUENCY : always
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
A DESCRIPTION OF THE PROBLEM :
The sun.misc.{Signal,SignalHandler,Unsafe} classes that were retained in JEP 260 are not included in the compiler tree ct.sym library for releases earlier than 9. Code targeting 1.8 that uses sun.misc.{Signal,SignalHandler} will compile without issue with --release 9 but not when --release 8 or earlier is used. This issue appears to have existed since the --release flag was first introduced.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the following code snippet using --release 8
class Main {{ sun.misc.Signal.class.getName(); }}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
test/Main.java:1: warning: Signal is internal proprietary API and may be removed in a future release
package test; class Main {{ sun.misc.Signal.class.getName(); }}
^
1 warning
ACTUAL -
test/Main.java:1: error: package sun.misc does not exist
package test; class Main {{ sun.misc.Signal.class.getName(); }}
^
1 error
---------- BEGIN SOURCE ----------
package test; class Main {{ sun.misc.Signal.class.getName(); }}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Build using a real JDK 1.8 toolchain or targeting Java 9+
FREQUENCY : always
- duplicates
-
JDK-8206937 --release=8 doesn't allow access to internal APIs
- Open