From 2a82a278637421eddbeb39fed28b63cb66e59b77 Mon Sep 17 00:00:00 2001 From: cpovirk Date: Mon, 19 Dec 2022 11:29:55 -0800 Subject: [PATCH] Remove flag for temporarily disabling checking of `getThis()` methods. Startblock: unknown commit is submitted PiperOrigin-RevId: 496450052 --- .../errorprone/bugpatterns/SelfAlwaysReturnsThis.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/SelfAlwaysReturnsThis.java b/core/src/main/java/com/google/errorprone/bugpatterns/SelfAlwaysReturnsThis.java index 227f4457540..e0036263d18 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/SelfAlwaysReturnsThis.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/SelfAlwaysReturnsThis.java @@ -27,7 +27,6 @@ import static com.google.errorprone.util.ASTHelpers.isVoidType; import com.google.errorprone.BugPattern; -import com.google.errorprone.ErrorProneFlags; import com.google.errorprone.VisitorState; import com.google.errorprone.bugpatterns.BugChecker.MethodTreeMatcher; import com.google.errorprone.fixes.SuggestedFix; @@ -57,12 +56,6 @@ + " class must always 'return this'", severity = WARNING) public final class SelfAlwaysReturnsThis extends BugChecker implements MethodTreeMatcher { - private final boolean matchGetThis; - - public SelfAlwaysReturnsThis(ErrorProneFlags flags) { - this.matchGetThis = flags.getBoolean("SelfAlwaysReturnsThis:GetThis").orElse(true); - } - @Override public Description matchMethod(MethodTree methodTree, VisitorState state) { MethodSymbol methodSymbol = getSymbol(methodTree); @@ -75,7 +68,7 @@ public Description matchMethod(MethodTree methodTree, VisitorState state) { // * have a body (not abstract) if (methodSymbol.isConstructor() || (!methodSymbol.getSimpleName().contentEquals("self") - && (!methodSymbol.getSimpleName().contentEquals("getThis") || !matchGetThis)) + && !methodSymbol.getSimpleName().contentEquals("getThis")) || !methodSymbol.getParameters().isEmpty() || methodSymbol.isStatic() || methodTree.getBody() == null) {