Incorporating fix for issue in current solution.
@@ -423,7 +423,7 @@ public class Visitor extends ASTVisitor {
!(invocation.getName().equals("length") && invocation.getArguments().size() == 0)) {
builderPatternChains.add(node);
}
- if(key.startsWith(methodInvocation) && invocation.numberOfSubExpressions() > 3 && invocation.containsVeryLongSubExpression()) {
+ if(key.startsWith(methodInvocation) && complexInvocation(invocation)) {
builderPatternChain = true;
}
}
@@ -439,6 +439,11 @@ public class Visitor extends ASTVisitor {
return super.visit(node);
}
+ private boolean complexInvocation(OperationInvocation invocation) {
+ return (invocation.numberOfSubExpressions() > 3 && invocation.containsVeryLongSubExpression()) ||
+ invocation.numberOfSubExpressions() > 15;
+ }
+
public static String processMethodInvocation(MethodInvocation node) {
StringBuilder sb = new StringBuilder();
sb.append(node.getName().getIdentifier());
