Fix for performance issue
Array creations with an initializer having a long list of expressions are no further visited.
@@ -16,6 +16,7 @@ import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
import org.eclipse.jdt.core.dom.ArrayAccess;
import org.eclipse.jdt.core.dom.ArrayCreation;
+import org.eclipse.jdt.core.dom.ArrayInitializer;
import org.eclipse.jdt.core.dom.ArrayType;
import org.eclipse.jdt.core.dom.BooleanLiteral;
import org.eclipse.jdt.core.dom.CastExpression;
@@ -115,6 +116,13 @@ public class Visitor extends ASTVisitor {
AnonymousClassDeclarationObject anonymous = (AnonymousClassDeclarationObject)current.getUserObject();
anonymous.getCreationMap().put(node.toString(), creation);
}
+ ArrayInitializer initializer = node.getInitializer();
+ if(initializer != null) {
+ List<Expression> expressions = initializer.expressions();
+ if(expressions.size() > 10) {
+ return false;
+ }
+ }
return super.visit(node);
}
