Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
oxkitsune committed Mar 1, 2024
1 parent 5865373 commit 3a75f22
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,10 @@ static ErrorProneAnalyzer createAnalyzer(
ImmutableSet<String> namedCheckers = epOptions.patchingOptions().namedCheckers();
if (!namedCheckers.isEmpty()) {
toUse = toUse.filter(bci -> namedCheckers.contains(bci.canonicalName()));
} else {
toUse = toUse.applyOverrides(epOptions);
}
return ErrorProneScannerTransformer.create(toUse.applyOverrides(epOptions).get());
return ErrorProneScannerTransformer.create(toUse.get());
})
.get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,26 @@ public void dontRunPatchForDisabledChecks() {
"}")
.setArgs(
"-XepPatchLocation:IN_PLACE",
"-XepPatchChecks:ShouldNotUseFoo",
"-XepPatchChecks:",
"-Xep:ShouldNotUseFoo:OFF")
.doTest();
}

@Test
public void dontRunPatchUnlessRequested() {
compilationHelper.addSourceLines(
"Test.java",
"import com.google.errorprone.scanner.ScannerTest.Foo;",
"class Test {",
" Foo foo;",
"}")
.setArgs(
"-XepPatchLocation:IN_PLACE",
"-Xep:ShouldNotUseFoo:WARN",
"-XepPatchChecks:DeadException"
).doTest();
}

@OkToUseFoo // Foo can use itself. But this shouldn't suppress errors on *usages* of Foo.
public static final class Foo<T> {}

Expand Down

0 comments on commit 3a75f22

Please sign in to comment.