The following example shows that 'compiler.warn.sun.proprietary' diagnostics are not emitted if --system is configured to an earlier JDK version. I expected the diagnostics to be emitted for both configurations.
The diagnostics are consistently emitted for different configurations of --release.
cat A.java
class A {
sun.misc.Unsafe theUnsafe;
}
$JAVA21_HOME/bin/java -fullversion
openjdk full version "21.0.2+13-58"
$JAVA11_HOME/bin/java -fullversion
openjdk full version "11.0.16+8"
$JAVA21_HOME/bin/javac --system $JAVA21_HOME A.java
A.java:2: warning: Unsafe is internal proprietary API and may be removed in a future release
sun.misc.Unsafe theUnsafe;
^
1 warning
$JAVA21_HOME/bin/javac --system $JAVA11_HOME A.java
...
no diagnostics
The diagnostics are consistently emitted for different configurations of --release.
cat A.java
class A {
sun.misc.Unsafe theUnsafe;
}
$JAVA21_HOME/bin/java -fullversion
openjdk full version "21.0.2+13-58"
$JAVA11_HOME/bin/java -fullversion
openjdk full version "11.0.16+8"
$JAVA21_HOME/bin/javac --system $JAVA21_HOME A.java
A.java:2: warning: Unsafe is internal proprietary API and may be removed in a future release
sun.misc.Unsafe theUnsafe;
^
1 warning
$JAVA21_HOME/bin/javac --system $JAVA11_HOME A.java
...
no diagnostics
- clones
-
JDK-8331081 'internal proprietary API' diagnostics if --system is configured to an earlier JDK version
- Closed
- relates to
-
JDK-8343770 Build fails due to use of sun.misc.Unsafe in LoopOverRandom
- Resolved
- links to
-
Commit(master) openjdk/jdk/839de82c
-
Review(master) openjdk/jdk/19397