RFR: 8333560: -Xlint:restricted does not work with --release [v3]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Jun 6 13:56:47 UTC 2024
On Wed, 5 Jun 2024 18:42:08 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
>
> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
>
> use enterSyntheticAnnotation
Marked as reviewed by mcimadamore (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/19548#pullrequestreview-2102057035
More information about the compiler-dev
mailing list