JDK-8280866 : SuppressWarnings does not work properly in package-info and module-info
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 19
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-01-28
  • Updated: 2022-02-23
  • Resolved: 2022-02-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 19
19 masterFixed
Related Reports
Relates :  
Description
Consider:
===package-info.java
@Ann
@SuppressWarnings("deprecation")
package test;
===Ann.java
package test;

@Deprecated @interface Ann {}
===

After JDK-8280744, this will produce:
---
$ javac -Xlint:deprecation *.java
package-info.java:1: warning: [deprecation] Ann in test has been deprecated
@Ann
 ^
1 warning
---

That appears to be clearly wrong, as the warning is suppressed.

Something similar is visible in module-info.

Comments
Changeset: e3365041 Author: Jan Lahoda <jlahoda@openjdk.org> Date: 2022-02-18 11:04:11 +0000 URL: https://git.openjdk.java.net/jdk/commit/e3365041bdef4dc09f3e5967124103e4364614fb
18-02-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/7266 Date: 2022-01-28 10:57:50 +0000
28-01-2022