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

Jonathan Gibbons jjg at openjdk.java.net
Mon Sep 13 15:41:55 UTC 2021


On Mon, 9 Aug 2021 13:33:06 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> 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.)

Nice work

-------------

Marked as reviewed by jjg (Reviewer).

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


More information about the compiler-dev mailing list