JDK-8231147 : 9.6.4.5: Clarify that @SuppressWarnings requires unknown strings to be ignored
  • Type: Bug
  • Component: specification
  • Sub-Component: language
  • Affected Version: 13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-09-17
  • Updated: 2019-12-23
  • Resolved: 2019-12-23
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 14
14Fixed
Related Reports
Relates :  
Relates :  
Description
The API specification for java.lang.SuppressWarnings states:

"The presence of unrecognized warning names is not an error: Compilers must ignore any warning names they do not recognize. They are, however, free to emit a warning if an annotation contains an unrecognized warning name."
https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/lang/SuppressWarnings.html#value()

This requirement to ignore unknown strings is not included in JLS 9.6.4.5. @SuppressWarnings. The JLS and API spec should be consistent in the requirements on compilers in handling the annotation. 
Comments
New wording: ----- The Java programming language defines four kinds of warnings which can be specified in `@SuppressWarnings` as follows: Unchecked warnings (...) are specified by the string "unchecked". Deprecation warnings (...) are ... Removal warnings (...) are ... Preview API warnings (1.5) are specified by the string "preview". [This paragraph is normative.] Only these kinds of warnings are standard. Any other string specifies a non-standard kind of warning. A Java compiler must ignore any such string that it does not recognize. Compiler vendors are encouraged to cooperate to ensure that the same strings are recognized across multiple compilers. [Delete this informative paragraph.] ~~For other kinds of warnings, compiler vendors should document the strings they support for @SuppressWarnings. Vendors are encouraged to cooperate to ensure that the same names work across multiple compilers.~~ -----
23-12-2019

FYI, incomplete sets of requirements observed during the code review of JDK-.8230854, https://mail.openjdk.java.net/pipermail/hotspot-dev/2019-September/039593.html
17-09-2019