@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void data) { for (final Expression argument : node.getArguments()) { argument.acceptVisitor(this, data); } processCall(node); return null; }
@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void data) { for (final Expression argument : node.getArguments()) { argument.acceptVisitor(this, data); } processCall(node); return null; }
@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void data) { for (final Expression argument : node.getArguments()) { argument.acceptVisitor(this, data); } processCall(node); return null; }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof ObjectCreationExpression) { final ObjectCreationExpression otherExpression = (ObjectCreationExpression) other; return !otherExpression.isNull() && getTarget().matches(otherExpression.getTarget(), match) && getType().matches(otherExpression.getType(), match) && getArguments().matches(otherExpression.getArguments(), match); } return false; } }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof ObjectCreationExpression) { final ObjectCreationExpression otherExpression = (ObjectCreationExpression) other; return !otherExpression.isNull() && getTarget().matches(otherExpression.getTarget(), match) && getType().matches(otherExpression.getType(), match) && getArguments().matches(otherExpression.getArguments(), match); } return false; } }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof ObjectCreationExpression) { final ObjectCreationExpression otherExpression = (ObjectCreationExpression) other; return !otherExpression.isNull() && getTarget().matches(otherExpression.getTarget(), match) && getType().matches(otherExpression.getType(), match) && getArguments().matches(otherExpression.getArguments(), match); } return false; } }
originalArguments = new ArrayList<>(instantiations.get(0).getArguments()); final Expression argumentToRemove = getOrDefault(instantiation.getArguments(), p.getPosition()); instantiation.getArguments().remove(argumentToRemove); final Expression argumentToRemove = getOrDefault(instantiation.getArguments(), argumentIndex);
originalArguments = new ArrayList<>(instantiations.get(0).getArguments()); final Expression argumentToRemove = getOrDefault(instantiation.getArguments(), p.getPosition()); instantiation.getArguments().remove(argumentToRemove); final Expression argumentToRemove = getOrDefault(instantiation.getArguments(), argumentIndex);
originalArguments = new ArrayList<>(instantiations.get(0).getArguments()); final Expression argumentToRemove = getOrDefault(instantiation.getArguments(), p.getPosition()); instantiation.getArguments().remove(argumentToRemove); final Expression argumentToRemove = getOrDefault(instantiation.getArguments(), argumentIndex);
final AstNodeCollection<Expression> arguments = initializer.getArguments(); final boolean trimArguments = arguments.size() == constructor.getParameters().size();
final AstNodeCollection<Expression> arguments = initializer.getArguments(); final boolean trimArguments = arguments.size() == constructor.getParameters().size();
@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void ignored) { startNode(node); final Expression target = node.getTarget(); if (target != null && !target.isNull()) { target.acceptVisitor(this, ignored); writeToken(Roles.DOT); } writeKeyword(ObjectCreationExpression.NEW_KEYWORD_ROLE); node.getType().acceptVisitor(this, ignored); space(policy.SpaceBeforeMethodCallParentheses); writeCommaSeparatedListInParenthesis(node.getArguments(), policy.SpaceWithinMethodCallParentheses); endNode(node); return null; }
@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void ignored) { startNode(node); final Expression target = node.getTarget(); if (target != null && !target.isNull()) { target.acceptVisitor(this, ignored); writeToken(Roles.DOT); } writeKeyword(ObjectCreationExpression.NEW_KEYWORD_ROLE); node.getType().acceptVisitor(this, ignored); space(policy.SpaceBeforeMethodCallParentheses); writeCommaSeparatedListInParenthesis(node.getArguments(), policy.SpaceWithinMethodCallParentheses); endNode(node); return null; }
@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void ignored) { startNode(node); final Expression target = node.getTarget(); if (target != null && !target.isNull()) { target.acceptVisitor(this, ignored); writeToken(Roles.DOT); } writeKeyword(ObjectCreationExpression.NEW_KEYWORD_ROLE); node.getType().acceptVisitor(this, ignored); space(policy.SpaceBeforeMethodCallParentheses); writeCommaSeparatedListInParenthesis(node.getArguments(), policy.SpaceWithinMethodCallParentheses); endNode(node); return null; }
@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void data) { final AstNodeCollection<Expression> arguments = node.getArguments(); if (arguments.isEmpty() || arguments.hasSingleElement()) { final Expression firstArgument; if (arguments.hasSingleElement()) { final Match m = _stringBuilderArgumentPattern.match(arguments.firstOrNullObject()); if (!m.success()) { return super.visitObjectCreationExpression(node, data); } firstArgument = firstOrDefault(m.<Expression>get("firstArgument")); } else { firstArgument = null; } final TypeReference typeReference = node.getType().toTypeReference(); if (typeReference != null && isStringBuilder(typeReference)) { convertStringBuilderToConcatenation(node, firstArgument); } } return super.visitObjectCreationExpression(node, data); }
@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void data) { final AstNodeCollection<Expression> arguments = node.getArguments(); if (arguments.isEmpty() || arguments.hasSingleElement()) { final Expression firstArgument; if (arguments.hasSingleElement()) { final Match m = _stringBuilderArgumentPattern.match(arguments.firstOrNullObject()); if (!m.success()) { return super.visitObjectCreationExpression(node, data); } firstArgument = firstOrDefault(m.<Expression>get("firstArgument")); } else { firstArgument = null; } final TypeReference typeReference = node.getType().toTypeReference(); if (typeReference != null && isStringBuilder(typeReference)) { convertStringBuilderToConcatenation(node, firstArgument); } } return super.visitObjectCreationExpression(node, data); }
@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void data) { final AstNodeCollection<Expression> arguments = node.getArguments(); if (arguments.isEmpty() || arguments.hasSingleElement()) { final Expression firstArgument; if (arguments.hasSingleElement()) { final Match m = _stringBuilderArgumentPattern.match(arguments.firstOrNullObject()); if (!m.success()) { return super.visitObjectCreationExpression(node, data); } firstArgument = firstOrDefault(m.<Expression>get("firstArgument")); } else { firstArgument = null; } final TypeReference typeReference = node.getType().toTypeReference(); if (typeReference != null && isStringBuilder(typeReference)) { convertStringBuilderToConcatenation(node, firstArgument); } } return super.visitObjectCreationExpression(node, data); }
super.visitObjectCreationExpression(node, data); final AstNodeCollection<Expression> arguments = node.getArguments();
super.visitObjectCreationExpression(node, data); final AstNodeCollection<Expression> arguments = node.getArguments();
super.visitObjectCreationExpression(node, data); final AstNodeCollection<Expression> arguments = node.getArguments();