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

[REDO] 'internal proprietary API' diagnostics if --system is configured to an earlier JDK version

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 24
    • None
    • tools
    • None
    • master

      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

            cushon Liam Miller-Cushon
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: