RFR: 8259039: Passing different version to --release flag than javac version output warning

Jan Lahoda jlahoda at openjdk.java.net
Thu Aug 12 08:31:39 UTC 2021

For code like:

com.sun.nio.file.ExtendedOpenOption o;

certain combination of command line options produce a proprietary warnings:

$ javac --release 11 T.java 
T.java:2: warning: ExtendedOpenOption is internal proprietary API and may be removed in a future release
    com.sun.nio.file.ExtendedOpenOption o;
1 warning

But some do not:

$ javac -source 8 T.java 
warning: [options] bootstrap class path not set in conjunction with -source 8
1 warning

The reason is that the `ct.properties` files does not mark `com.sun.nio.file` as proprietary. The proposed fix has two parts:
-adds `proprietary` to the `com.sun.nio.file` package in `ct.properties`
-limits the `ct.properties` so that it is only used for `-source 8`. The `ct.properties` contains 3 types of information: it hides some packages, it marks some packages as "proprietary" (so that they produce the warning), and assigns packages to compact profiles. For `-source 9+`, most of these is not needed - packages are hidden using the module system, the only packages that need a warning are from the `jdk.unsupported` module, and there are no compact profiles. So for `-source 9+`, we don't need to use the `ct.properties`. (Note none of this applies to `--release` - it uses a different database.)


Commit messages:
 - Removing trailing whitespace.
 - 8259039: Passing different version to --release flag than javac version output warning

Changes: https://git.openjdk.java.net/jdk/pull/5053/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5053&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8259039
  Stats: 162 lines in 4 files changed: 152 ins; 4 del; 6 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5053.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5053/head:pull/5053

PR: https://git.openjdk.java.net/jdk/pull/5053

More information about the compiler-dev mailing list