-Xlint:unnecessary ?
Archie Cobbs
archie.cobbs at gmail.com
Fri Oct 6 21:08:01 UTC 2023
I had an idea for a new lint warning and wanted to get feedback from those
who understand the lint system better than me about the idea and whether
this is feasible.
The name of the new warning would be something like "unnecessary".
The idea is that if you said -Xlint:foobar,unnecessary then you would get a
warning for any unnecessary @SuppressWarnings("foobar") annotations,
meaning, there are actually no warnings that need suppressing at that spot,
and so the annotation is unnecessary and can be removed.
The reason you would need to do -Xlint:foobar,unnecessary instead of just
plain -Xlint:unnecessary to cover all of them is because in some cases if
-Xlint:foobar is not specified then the logic for detecting foobar warnings
is completely disabled, so it's not possible to know when the warning would
or would not have fired. Also, this makes the control more precise.
The benefit of this of course is it helps avoid accidental warning
suppression (false negatives) by making it easier to minimize your
suppression surface.
I started trying to evaluate doing this, but am not completely
understanding how lint and "deferred lint" interact.
Is there a lint expert who can comment on whether this would be feasible
given the way lint is currently implemented?
Thanks,
-Archie
--
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20231006/ad67ce3c/attachment-0001.htm>
More information about the compiler-dev
mailing list