mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 08:11:25 +00:00
More minor tweaks
This commit is contained in:
@@ -10,6 +10,7 @@ import com.google.errorprone.bugpatterns.BugChecker.MethodTreeMatcher;
|
||||
import com.google.errorprone.matchers.Description;
|
||||
import com.google.errorprone.util.ASTHelpers;
|
||||
import com.sun.source.tree.MethodTree;
|
||||
import com.sun.tools.javac.code.Symbol;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
final class ConflictDetectionTest {
|
||||
@@ -18,28 +19,28 @@ final class ConflictDetectionTest {
|
||||
CompilationTestHelper.newInstance(RenameBlockerFlagger.class, getClass())
|
||||
.addSourceLines(
|
||||
"/A.java",
|
||||
"import static staticimport.B.foo3t;",
|
||||
"import static pkg.B.foo3t;",
|
||||
"",
|
||||
"class A {",
|
||||
" private void foo1() {",
|
||||
" foo3t();",
|
||||
" }",
|
||||
"",
|
||||
" // BUG: Diagnostic contains: [RenameBlockerFlagger] a method named `foo2t` is already defined in",
|
||||
" // this class or a supertype",
|
||||
" // BUG: Diagnostic contains: a method named `foo2t` is already defined in this class or a",
|
||||
" // supertype",
|
||||
" private void foo2() {}",
|
||||
"",
|
||||
" private void foo2t() {}",
|
||||
"",
|
||||
" // BUG: Diagnostic contains: [RenameBlockerFlagger] `foo3t` is already statically imported",
|
||||
" // BUG: Diagnostic contains: `foo3t` is already statically imported",
|
||||
" private void foo3() {}",
|
||||
"",
|
||||
" // BUG: Diagnostic contains: [RenameBlockerFlagger] `int` is not a valid identifier",
|
||||
" // BUG: Diagnostic contains: `int` is not a valid identifier",
|
||||
" private void in() {}",
|
||||
"}")
|
||||
.addSourceLines(
|
||||
"/staticimport/B.java",
|
||||
"package staticimport;",
|
||||
"/pkg/B.java",
|
||||
"package pkg;",
|
||||
"",
|
||||
"public class B {",
|
||||
" public static void foo3t() {}",
|
||||
@@ -47,6 +48,10 @@ final class ConflictDetectionTest {
|
||||
.doTest();
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link BugChecker} that flags method rename blockers found by {@link
|
||||
* ConflictDetection#findMethodRenameBlocker(Symbol.MethodSymbol, String, VisitorState)}.
|
||||
*/
|
||||
@BugPattern(summary = "Flags blockers for renaming methods", severity = ERROR)
|
||||
public static final class RenameBlockerFlagger extends BugChecker implements MethodTreeMatcher {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
Reference in New Issue
Block a user