Skip to content

Commit

Permalink
Hack out RedundantSetterCall:MatchOneOfs flag; it's now enabled.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 644712978
  • Loading branch information
graememorgan authored and Error Prone Team committed Jun 19, 2024
1 parent 9cd9b38 commit 3e4aa1d
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import com.google.common.collect.ListMultimap;
import com.google.errorprone.BugPattern;
import com.google.errorprone.BugPattern.StandardTags;
import com.google.errorprone.ErrorProneFlags;
import com.google.errorprone.VisitorState;
import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher;
import com.google.errorprone.fixes.SuggestedFix;
Expand Down Expand Up @@ -106,21 +105,16 @@ && isWithinAutoValueBuilder(symbol, state)
(ExpressionTree) state.getPath().getParentPath().getParentPath().getLeaf(),
state)));

private final boolean matchOneOfs;

@Inject
RedundantSetterCall(ErrorProneFlags flags) {
this.matchOneOfs = flags.getBoolean("RedundantSetterCall:MatchOneOfs").orElse(true);
}
RedundantSetterCall() {}

@Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
if (!TERMINAL_FLUENT_SETTER.matches(tree, state)) {
return Description.NO_MATCH;
}
ListMultimap<Field, FieldWithValue> setters = ArrayListMultimap.create();
ImmutableMap<String, OneOfField> oneOfSetters =
matchOneOfs ? scanForOneOfSetters(getType(tree), state) : ImmutableMap.of();
ImmutableMap<String, OneOfField> oneOfSetters = scanForOneOfSetters(getType(tree), state);
Type type = ASTHelpers.getReturnType(tree);
for (ExpressionTree current = tree;
FLUENT_SETTER.matches(current, state);
Expand Down

0 comments on commit 3e4aa1d

Please sign in to comment.