diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssociativeMethodInvocation.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssociativeMethodInvocation.java index 84551577533..fd347c0819f 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssociativeMethodInvocation.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssociativeMethodInvocation.java @@ -7,7 +7,6 @@ import static com.google.errorprone.matchers.Matchers.not; import static com.google.errorprone.matchers.Matchers.staticMethod; import static com.google.errorprone.matchers.Matchers.toType; -import static java.util.stream.Collectors.joining; import static tech.picnic.errorprone.bugpatterns.util.Documentation.BUG_PATTERNS_BASE_URL; import com.google.auto.service.AutoService; @@ -73,7 +72,7 @@ public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState fix.merge( invocation.getArguments().isEmpty() ? SuggestedFixes.removeElement(arg, tree.getArguments(), state) - : unwrapMethodInvocation(invocation, state)); + : SourceCode.unwrapMethodInvocation(invocation, state)); } } @@ -84,16 +83,6 @@ public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState return Description.NO_MATCH; } - // XXX: Test this code with comments. - private static SuggestedFix unwrapMethodInvocation( - MethodInvocationTree tree, VisitorState state) { - return SuggestedFix.replace( - tree, - tree.getArguments().stream() - .map(arg -> SourceCode.treeToString(arg, state)) - .collect(joining(", "))); - } - private static Matcher hasArgumentOfType(Supplier type) { return (tree, state) -> tree.getArguments().stream()