Skip to content

Commit

Permalink
Fix #1159: StrictUnusedVariable respects UnusedVariable suppression (#…
Browse files Browse the repository at this point in the history
…1160)

StrictUnusedVariable respects UnusedVariable suppression
  • Loading branch information
carterkozak authored and bulldozer-bot[bot] committed Jan 10, 2020
1 parent c4fb0df commit 8ecf71f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
@AutoService(BugChecker.class)
@BugPattern(
name = "StrictUnusedVariable",
altNames = {"unused", "StrictUnusedVariable"},
altNames = {"unused", "UnusedVariable"},
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
summary = "Unused.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,19 @@ public void fixes_previously_suppressed_variables() {
"}"
).doTest(TestMode.TEXT_MATCH);
}

@Test
public void testSuppression() {
refactoringTestHelper
.addInputLines(
"Test.java",
"class Test {",
" public static void a(@SuppressWarnings(\"StrictUnusedVariable\") int val) {}",
" public static void b(@SuppressWarnings(\"UnusedVariable\") int val) {}",
" public static void c(@SuppressWarnings(\"unused\") int val) {}",
" public static void d(int _val) {}",
"}")
.expectUnchanged()
.doTest(TestMode.TEXT_MATCH);
}
}
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-1160.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: StrictUnusedVariable respects UnusedVariable suppression
links:
- https://github.com/palantir/gradle-baseline/pull/1160

0 comments on commit 8ecf71f

Please sign in to comment.