RFR: 8344159: Add lint warnings for unnecessary warning suppression

Archie Cobbs acobbs at openjdk.org
Wed Oct 29 20:54:19 UTC 2025


On Tue, 16 Sep 2025 13:32:15 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> This PR adds a new compiler warning for `@SuppressWarnings` annotations that don't actually suppress any warnings.
>> 
>> Summary of code changes:
>> 
>> * Add new warning and associated lint category `"suppression"`
>> * Update `LintMapper` to keep track of which `@SuppressWarnings` suppressions have been validated ¹
>> * Update `Log.warning()` so it validates any current suppression of the warning's lint category in effect.
>> * Add a new `validate` parameter to `Lint.isEnabled()` and `Lint.isSuppressed()` that specifies whether to also validate any current suppression.
>> * Add `Lint.isActive()` to check whether a category is enabled _or_ suppression of the category is being tracked - in other words, whether the warning calculation needs to be performed. Used for non-trivial warning calculations.
>> * Add `-Xlint:-suppression` flags to `*.gmk` build files so the build doesn't break
>> 
>> ¹ The suppression of a lint category is "validated" as soon as it suppresses some warning in that category
>
>> /label remove kulla
> 
> I have removed kulla-dev from the bot configuration so the stuck label is now benign.

@erikj79, @magicus - Would you mind updating your review since the recent changes that addressed merge conflicts?

Thanks!

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

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


More information about the compiler-dev mailing list