Integrated: 8333560: -Xlint:restricted does not work with --release
Jorn Vernee
jvernee at openjdk.org
Thu Jun 6 15:21:50 UTC 2024
On Tue, 4 Jun 2024 18:43:10 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
> Currently, `-Xlint:restricted` can be used to print out lint warnings when restricted methods are used in source code compiled by javac. However, this option doesn't work as intended when used in combination with `--release`, and instead no warnings are printed at all.
>
> Javac relies on the internal `jdk.internal.javac.Restricted` annotation being present on a method in order to determine if a method is restricted. This annotation is however currently being stripped out when generating shim class files that are used by javac to get release-specific symbol information.
>
> There are already some annotations that are exempt from being stripped away, such as `jdk.internal.javac.PreviewFeature`. The proposed fix is to add `jdk.internal.javac.Restricted` to the list of exempted annotations as well.
>
> Testing: tier 1-3
This pull request has now been integrated.
Changeset: 02f24041
Author: Jorn Vernee <jvernee at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/02f240415cbda5f67a91af50d5974fb001104170
Stats: 20 lines in 5 files changed: 14 ins; 0 del; 6 mod
8333560: -Xlint:restricted does not work with --release
Co-authored-by: Jan Lahoda <jlahoda at openjdk.org>
Reviewed-by: vromero, mcimadamore
-------------
PR: https://git.openjdk.org/jdk/pull/19548
More information about the compiler-dev
mailing list