Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,11 @@ public R scan(TreePath treePath, P param) {
}

private boolean suppressed(Tree tree) {
boolean ignoreSuppressions = state.errorProneOptions().isIgnoreSuppressionAnnotations();
if (ignoreSuppressions) {
return false;
}

boolean isSuppressible =
tree instanceof ClassTree || tree instanceof MethodTree || tree instanceof VariableTree;
return isSuppressible && isSuppressed(tree, state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,26 @@ String s(Runnable r) {
.doTest();
}

@Test
public void suppressibleTreePathScanner_respectsIgnoreSuppressionAnnotationsFlag() {
CompilationTestHelper.newInstance(SuppressibleTreePathScannerCheck.class, getClass())
.setArgs("-XepIgnoreSuppressionAnnotations")
.addSourceLines(
"A.java",
"""
class A {
void m() {
// BUG: Diagnostic contains:
int unsuppressed;
@SuppressWarnings("foo")
// BUG: Diagnostic contains:
int suppressed;
}
}
""")
.doTest();
}

@Test
public void isSuppressed_disableWarningsInGeneratedCode() {
CompilationTestHelper.newInstance(CustomSuppressibilityCheck.class, getClass())
Expand Down