/** * Returns whether the given node and the other object match. * <p> * The default implementation provided by this class tests whether the * other object is a node of the same type with structurally isomorphic * child subtrees. Subclasses may override this method as needed. * </p> * * @param node the node * @param other the other object, or <code>null</code> * @return <code>true</code> if the subtree matches, or * <code>false</code> if they do not match or the other object has a * different node type or is <code>null</code> */ public boolean match(ConstructorInvocation node, Object other) { if (!(other instanceof ConstructorInvocation)) { return false; } ConstructorInvocation o = (ConstructorInvocation) other; if (node.getAST().apiLevel >= AST.JLS3_INTERNAL) { if (!safeSubtreeListMatch(node.typeArguments(), o.typeArguments())) { return false; } } return safeSubtreeListMatch(node.arguments(), o.arguments()); }
@Override ASTNode clone0(AST target) { ConstructorInvocation result = new ConstructorInvocation(target); result.setSourceRange(getStartPosition(), getLength()); result.copyLeadingComment(this); if (this.ast.apiLevel >= AST.JLS3_INTERNAL) { result.typeArguments().addAll(ASTNode.copySubtrees(target, typeArguments())); } result.arguments().addAll(ASTNode.copySubtrees(target, arguments())); return result; }
public final void endVisit(final ConstructorInvocation node) { final IMethodBinding binding= node.resolveConstructorBinding(); if (binding != null) endVisit(node.arguments(), binding); }
@Override final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == ARGUMENTS_PROPERTY) { return arguments(); } if (property == TYPE_ARGUMENTS_PROPERTY) { return typeArguments(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
ConstructorInvocation constructorInvocation = new ConstructorInvocation(this.ast); org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = statement.arguments; if (arguments != null) { int length = arguments.length; for (int i = 0; i < length; i++) { constructorInvocation.arguments().add(convert(arguments[i])); constructorInvocation.setFlags(constructorInvocation.getFlags() | ASTNode.MALFORMED); break; default : for (int i = 0, max = statement.typeArguments.length; i < max; i++) { constructorInvocation.typeArguments().add(convertType(statement.typeArguments[i])); constructorInvocation.setFlags(constructorInvocation.getFlags() | ASTNode.MALFORMED);
@Override public boolean visit(ConstructorInvocation node) { if (isExitPoint(node.resolveConstructorBinding())) { // mark 'this' fResult.add(new OccurrenceLocation(node.getStartPosition(), 4, 0, fExitDescription)); } return true; }
public boolean visit(ConstructorInvocation node) { if (!hasChildrenChanges(node)) { return doVisitUnchangedChildren(node); } int pos= node.getStartPosition(); if (node.getAST().apiLevel() >= JLS3_INTERNAL) { pos= rewriteOptionalTypeParameters(node, ConstructorInvocation.TYPE_ARGUMENTS_PROPERTY, pos, Util.EMPTY_STRING, false, false); } try { pos= getScanner().getTokenEndOffset(TerminalTokens.TokenNameLPAREN, pos); rewriteNodeList(node, ConstructorInvocation.ARGUMENTS_PROPERTY, pos, Util.EMPTY_STRING, ", "); //$NON-NLS-1$ } catch (CoreException e) { handleException(e); } return false; }
/** * handles this(parameter) */ @SuppressWarnings("unchecked") @Override public boolean visit(ConstructorInvocation node) { Invocation invocation = importer.createInvocationFromMethodBinding(node.resolveConstructorBinding(), node.toString().trim()); importer.createLightweightSourceAnchor(invocation, node); node.arguments().stream().forEach(arg -> importer.createAccessFromExpression((Expression) arg)); return true; }
@Override public void endVisit(ConstructorInvocation node) { if (skipNode(node)) { return; } processSequential(node, node.arguments()); }
@Override public boolean visit(ConstructorInvocation node) { if (!isSelected(node)) { return false; } return handleExceptions(node.resolveConstructorBinding(), node); }
public boolean visit(ConstructorInvocation node) { if (!isSelected(node)) return false; return handleExceptions(node.resolveConstructorBinding(), node.getAST()); }
@Override public boolean visit(ConstructorInvocation node) { if (node.getAST().apiLevel() >= JLS3_INTERNAL) { visitList(node, ConstructorInvocation.TYPE_ARGUMENTS_PROPERTY, String.valueOf(','), String.valueOf('<'), String.valueOf('>')); } this.result.append("this("); //$NON-NLS-1$ visitList(node, ConstructorInvocation.ARGUMENTS_PROPERTY, String.valueOf(',')); this.result.append(");"); //$NON-NLS-1$ return false; }
@Override void accept0(ASTVisitor visitor) { boolean visitChildren = visitor.visit(this); if (visitChildren) { if (this.ast.apiLevel >= AST.JLS3_INTERNAL) { acceptChildren(visitor, this.typeArguments); } acceptChildren(visitor, this.arguments); } visitor.endVisit(this); }
/** * Creates an unparented alternate constructor ("this(...);") invocation * statement node owned by this AST. By default, the lists of arguments * and type arguments are both empty. * <p> * Note that this type of node is a Statement, whereas a regular * method invocation is an Expression. The only valid use of these * statements are as the first statement of a constructor body. * </p> * * @return a new unparented alternate constructor invocation statement node */ public ConstructorInvocation newConstructorInvocation() { ConstructorInvocation result = new ConstructorInvocation(this); return result; }
final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == ARGUMENTS_PROPERTY) { return arguments(); } if (property == TYPE_ARGUMENTS_PROPERTY) { return typeArguments(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
ConstructorInvocation constructorInvocation = new ConstructorInvocation(this.ast); org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = statement.arguments; if (arguments != null) { int length = arguments.length; for (int i = 0; i < length; i++) { constructorInvocation.arguments().add(convert(arguments[i])); constructorInvocation.setFlags(constructorInvocation.getFlags() | ASTNode.MALFORMED); break; default : for (int i = 0, max = statement.typeArguments.length; i < max; i++) { constructorInvocation.typeArguments().add(convertType(statement.typeArguments[i])); constructorInvocation.setFlags(constructorInvocation.getFlags() | ASTNode.MALFORMED);
@Override public boolean visit(ConstructorInvocation node) { if (isExitPoint(node.resolveConstructorBinding())) { // mark 'this' fResult.add(new OccurrenceLocation(node.getStartPosition(), 4, 0, fExitDescription)); } return true; }
public boolean visit(ConstructorInvocation node) { if (!hasChildrenChanges(node)) { return doVisitUnchangedChildren(node); } int pos= node.getStartPosition(); if (node.getAST().apiLevel() >= JLS3_INTERNAL) { pos= rewriteOptionalTypeParameters(node, ConstructorInvocation.TYPE_ARGUMENTS_PROPERTY, pos, Util.EMPTY_STRING, false, false); } try { pos= getScanner().getTokenEndOffset(TerminalTokens.TokenNameLPAREN, pos); rewriteNodeList(node, ConstructorInvocation.ARGUMENTS_PROPERTY, pos, Util.EMPTY_STRING, ", "); //$NON-NLS-1$ } catch (CoreException e) { handleException(e); } return false; }
@Override public void endVisit(ConstructorInvocation node) { if (skipNode(node)) return; processSequential(node, node.arguments()); }
@Override public boolean visit(ConstructorInvocation node) { if (!isSelected(node)) return false; return handleExceptions(node.resolveConstructorBinding(), node); }