On Wed, 24 Sep 2025 16:33:18 GMT, Pavel Rappo <pra...@openjdk.org> wrote:

> Basically, if `@SuppressWarnings("suppression")` was accidentally left with 
> no suppressions under it, the compiler would warn you, so you could remove 
> it. Because what's the reason for `@SuppressWarnings("suppression")` whose 
> scope contains no suppressions?

Sorry I didn't address this question before - but yes, this is a reasonable 
ida. It would basically be adding an exception to the exception. So, a bit of 
additional complexity but for a worthwhile cause. To stretch the analogy, it 
would be like making the observation: "If the area of the wall is zero, then 
you never need to post a "POST NO BILLS" bill on it".

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".

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25167#issuecomment-3329828755

Reply via email to