You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StrictUnusedVariable should respect -XoptIgnoreSuppressionAnnotations; @SuppressWarnings("UnusedVariable") no longer suppresses StrictUnusedVariable#3384
Open
kelvinou01 wants to merge 3 commits intodeveloppalantir/gradle-baseline:developfrom
okelvin/respect-the-flagpalantir/gradle-baseline:okelvin/respect-the-flagCopy head branch name to clipboard
StrictUnusedVariable opts out of SuppressibleTreePathScanner's suppression mechanism, and checks for suppressions manually. This interferes with suppressible-error-prone's removeUnused mode, which relies on modifying SuppressibleTreePathScanner.
StrictUnusedVariable has a quirky setup to deal with alt-names, so that@SuppressWarnings("UnusedVariable") suppresses it, but errorProneOpotions.disable("UnusedVariable") does not disable it. This also interferes with RemoveUnused mode, as it doesn't know @SuppressWarnings("UnusedVariable") is a suppression for StrictUnusedVariable
After this PR
I think UnusedVariable (from which StrictUnusedVariable is mostly copied from) didn't use SuppressibleTreePathScanner because the class was new at the time (2022), but now we can switch to using SuppressibleTreePathScanner to get our modifications
It is reasonable that @SuppressWarnings("UnusedVariable") should only suppress UnusedVariable, @SuppressWarnings("StrictUnusedVariable") should only suppress StrictUnusedVariable, and SuppressWarnings("unused") is the catch-all suppression for all unused checks (including UnusedMethod). Let's implement this behavior so removeUnused mode can work with StrictUnusedVariable.
==COMMIT_MSG==
StrictUnusedVariable should respect -XoptIgnoreSuppressionAnnotations; @SuppressWarnings("UnusedVariable") no longer suppresses StrictUnusedVariable
==COMMIT_MSG==
kelvinou01
changed the title
StrictUnusedVariable should respect -XoptIgnoreSuppressionAnnotations
Make StrictUnusedVariable use SuppressibleTreePathScanner, and it shouldn't be suppressed by @SuppressWarnings("UnusedVariable")
Nov 30, 2025
Simply interact with the changelog bot comment again to regenerate these entries.
📋Changelog Preview
🐛 Fixes
StrictUnusedVariable should respect -XoptIgnoreSuppressionAnnotations (#3384)
kelvinou01
changed the title
Make StrictUnusedVariable use SuppressibleTreePathScanner, and it shouldn't be suppressed by @SuppressWarnings("UnusedVariable")
Make StrictUnusedVariable use SuppressibleTreePathScanner, @SuppressWarnings("UnusedVariable") no longer suppresses StrictUnusedVariable
Nov 30, 2025
kelvinou01
changed the title
Make StrictUnusedVariable use SuppressibleTreePathScanner, @SuppressWarnings("UnusedVariable") no longer suppresses StrictUnusedVariable
Make StrictUnusedVariable use SuppressibleTreePathScanner; @SuppressWarnings("UnusedVariable") no longer suppresses StrictUnusedVariable
Nov 30, 2025
kelvinou01
changed the title
Make StrictUnusedVariable use SuppressibleTreePathScanner; @SuppressWarnings("UnusedVariable") no longer suppresses StrictUnusedVariable
StrictUnusedVariable should respect -XoptIgnoreSuppressionAnnotations; @SuppressWarnings("UnusedVariable") no longer suppresses StrictUnusedVariable
Dec 1, 2025
When this rolls out, places with @SuppressWarnings("UnusedVariable") will additionally suppress for-rollout:StrictUnusedVariable. Then, when removeUnused mode is fixed, we can remove the unused suppressions on UnusedVariable.
We're currently moving all the error-prone infrastructure in gradle-baseline (including baseline-error-prone, baseline-nullaway) to https://github.com/palantir/baseline-error-prone. This PR should be opened in the new repository once setup is completed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this PR
@SuppressWarnings("UnusedVariable")suppresses it, buterrorProneOpotions.disable("UnusedVariable")does not disable it. This also interferes with RemoveUnused mode, as it doesn't know@SuppressWarnings("UnusedVariable")is a suppression for StrictUnusedVariableAfter this PR
@SuppressWarnings("UnusedVariable")should only suppress UnusedVariable,@SuppressWarnings("StrictUnusedVariable")should only suppress StrictUnusedVariable, andSuppressWarnings("unused")is the catch-all suppression for all unused checks (including UnusedMethod). Let's implement this behavior so removeUnused mode can work with StrictUnusedVariable.==COMMIT_MSG==
StrictUnusedVariable should respect
-XoptIgnoreSuppressionAnnotations;@SuppressWarnings("UnusedVariable")no longer suppresses StrictUnusedVariable==COMMIT_MSG==
Possible downsides?