Proposal: Warnings for unnecessary warning suppression
Joseph D. Darcy
joe.darcy at oracle.com
Tue Mar 4 06:16:20 UTC 2025
PS Belated comments when catching up on email...
On 11/9/2024 2:50 PM, Archie Cobbs wrote:
> *Overview*
>
> This is a proposal to add the ability for the compiler to detect and
> report unnecessary warning suppressions.
>
> An "unnecessary warning suppression" is when one of the following happens:
>
> * There is a @SuppressWarnings("foo")annotation, but if it hadn't
> been there, no foo warning would have been generated within the
> annotation's scope
> * The compiler is passed -Xlint:-foo, but if it hadn't been, no foo
> warning wouldhave been generated during the entire compilation
>
Another consideration is being able to successfully compile a code base
under multiple javac versions. A particular important instance of this
is boot strapping the JDK :-)
Cases that have occurred in the past that would make such a discipline
challenging include:
* Correctness fixes to the warning computation
* Expanding (or narrowing) the scope of what the warning looks for (e.g.
the serial warning)
So perhaps "messages" about "unnecessary warning suppression" should be
relayed somewhat outside of the existing warnings mechanism.
Cheers,
-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20250303/3976d9c8/attachment-0001.htm>
More information about the compiler-dev
mailing list