@Override public ResolveResult visitObjectCreationExpression(final ObjectCreationExpression node, final Void _) { /* final ResolveResult result = resolveTypeFromMember(node.getUserData(Keys.MEMBER_REFERENCE)); if (result != null) { return result; } */ return node.getType().acceptVisitor(this, _); }
@Override public ResolveResult visitObjectCreationExpression(final ObjectCreationExpression node, final Void _) { /* final ResolveResult result = resolveTypeFromMember(node.getUserData(Keys.MEMBER_REFERENCE)); if (result != null) { return result; } */ return node.getType().acceptVisitor(this, _); }
@Override public ResolveResult visitObjectCreationExpression(final ObjectCreationExpression node, final Void p) { /* final ResolveResult result = resolveTypeFromMember(node.getUserData(Keys.MEMBER_REFERENCE)); if (result != null) { return result; } */ return node.getType().acceptVisitor(this, p); }
@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void _) { super.visitObjectCreationExpression(node, _); final TypeReference type = node.getType().getUserData(Keys.TYPE_REFERENCE); final TypeDefinition resolvedType = type != null ? type.resolve() : null; if (resolvedType != null && isLocalOrAnonymous(resolvedType)) { List<ObjectCreationExpression> instantiations = _instantiations.get(type); if (instantiations == null) { _instantiations.put(type, instantiations = new ArrayList<>()); } instantiations.add(node); } return null; }
@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void _) { super.visitObjectCreationExpression(node, _); final TypeReference type = node.getType().getUserData(Keys.TYPE_REFERENCE); final TypeDefinition resolvedType = type != null ? type.resolve() : null; if (resolvedType != null && isLocalOrAnonymous(resolvedType)) { List<ObjectCreationExpression> instantiations = _instantiations.get(type); if (instantiations == null) { _instantiations.put(type, instantiations = new ArrayList<>()); } instantiations.add(node); } return null; }
@Override public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void p) { super.visitObjectCreationExpression(node, p); final TypeReference type = node.getType().getUserData(Keys.TYPE_REFERENCE); final TypeDefinition resolvedType = type != null ? type.resolve() : null; if (resolvedType != null && isLocalOrAnonymous(resolvedType) && !resolvedType.isEquivalentTo(context.getCurrentType())) { List<ObjectCreationExpression> instantiations = _instantiations.get(type); if (instantiations == null) { _instantiations.put(type, instantiations = new ArrayList<>()); } instantiations.add(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; } }
@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); }