RFR JDK-8194764: javac incorrectly flags deprecated for removal imports
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Jan 25 17:54:07 UTC 2018
Looks good,
sorry for the mistake :-)
Maurizio
On 25/01/18 17:44, Jan Lahoda wrote:
> Hi,
>
> For a sample code like:
> --- D.java
> package a;
>
> @Deprecated(forRemoval=true)
> public class D {}
> ---A.java
> package a;
>
> import a.D;
>
> public class A {
> public static void main(String[] args) {
> D d;
> }
> }
> ---
>
> When javac is invoked (on JDK 10+) with -source 9, there is an
> incorrect deprecation warning on import (this warning should not be
> printed, and was not printed on JDK 9):
> ---
> $ javac -source 9 D.java A.java
> warning: [options] bootstrap class path not set in conjunction with
> -source 9
> A.java:3: warning: [removal] D in a has been deprecated and marked for
> removal
> import a.D;
> ^
> A.java:7: warning: [removal] D in a has been deprecated and marked for
> removal
> D d;
> ^
> 3 warnings
> ---
>
> This appears to be caused by small mistake that enabled deprecation
> warnings for source levels up to 9, inclusive, while it should be
> enabled only for source levels up to 8, inclusive.
>
> Proposed webrev: http://cr.openjdk.java.net/~jlahoda/8194764/webrev.00/
> Bug: https://bugs.openjdk.java.net/browse/JDK-8194764
>
> How does this look?
>
> Thanks,
> Jan
More information about the compiler-dev
mailing list