RFR: 8333560: -Xlint:restricted does not work with --release [v2]

Jorn Vernee jvernee at openjdk.org
Wed Jun 5 17:47:57 UTC 2024


On Wed, 5 Jun 2024 11:25:22 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 (ongoing)
>
> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
> 
>   add Jan's patch that adds internal fake annotation

I'm taking a look at the failed  test. Will re-run tier 1-3 as well.

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

PR Comment: https://git.openjdk.org/jdk/pull/19548#issuecomment-2150618982


More information about the compiler-dev mailing list