RFR: 8344159: Add lint warnings for unnecessary warning suppression
Pavel Rappo
prappo at openjdk.org
Thu Sep 25 09:28:21 UTC 2025
On Wed, 24 Sep 2025 16:45:35 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:
> I can think of one possible wrinkle though: warnings can actually be suppressed in the source code in two ways, by `@SuppressWarnings` and by `@Deprecated` (see `Lint.suppressionsFrom(Symbol)`). So you'd also have to look for `@Deprecated`; but this also brings up the unsettling possibility that in the future, some new annotation might have a similar side-effect, and then we'd be in trouble again. So there is an aspect of this idea that requires us to make certain predictions about the future, which of course is dangerous. I think it's safer to "just say no".
`@Deprecated` as well as a conceivable future tag whose secondary effect is to silence possible warnings are very different from `@SuppressWarnings`. While I don't see why we might need to consider those underneath `@SuppressWarnings("suppression")` to decide if it should emit a warning, it's okay to say that it's safer not to complicate things. Thanks.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25167#issuecomment-3333072769
More information about the serviceability-dev
mailing list