JDK-8331081 : 'internal proprietary API' diagnostics if --system is configured to an earlier JDK version
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2024-04-24
  • Updated: 2024-05-27
  • Resolved: 2024-05-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 b24Fixed
Related Reports
Cloners :  
Relates :  
Description
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
Comments
Backed out in https://bugs.openjdk.org/browse/JDK-8332740
22-05-2024

> Looks like this change is causing build warnings which get turned into errors There are pre-existing warnings for uses of those APIs, e.g.: $ javac T.java T.java:1: warning: Unsafe is internal proprietary API and may be removed in a future release class A { sun.misc.Unsafe theUnsafe; } ^ 1 warning those warnings are errors if -Werror is passed. The intent of the change is that the warnings were not being emitted if --system was configured to a non-default value, and now they're consistently emitted regardless of the value of --system. One workaround would be to avoid passing -Werror to the affected invocations.
22-05-2024

Looks like this change is causing build warnings which get turned into errors. Lots and lots of this type of warning: test/micro/org/openjdk/bench/java/lang/foreign/LoopOverConstant.java:36: warning: Unsafe is internal proprietary API and may be removed in a future release import sun.misc.Unsafe; ^ It may or may not be limited to the micros.
22-05-2024

Changeset: 2170e99c Author: Liam Miller-Cushon <cushon@openjdk.org> Date: 2024-05-22 18:02:37 +0000 URL: https://git.openjdk.org/jdk/commit/2170e99cb49a4ef2086ecec7515a72d56148d0f2
22-05-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19069 Date: 2024-05-02 19:23:11 +0000
02-05-2024

Things are going wrong here: https://github.com/openjdk/jdk/blob/cd3a607576bede17f48c3d5ebde2bf05f3b615ba/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L244 The logic below would handles non-default jrt filesystems correctly: } else if (owningModule.name == names.jdk_unsupported) { newFlags |= PROPRIETARY; but it bails out when it sees a non-default jrt filesystem.
02-05-2024