List of usage examples for org.eclipse.jdt.core.dom ConstructorInvocation typeArguments
ASTNode.NodeList typeArguments
To view the source code for org.eclipse.jdt.core.dom ConstructorInvocation typeArguments.
Click Source Link
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(ConstructorInvocation node) { if (node.getAST().apiLevel() >= JLS3) { if (!node.typeArguments().isEmpty()) { this.fBuffer.append("<");//$NON-NLS-1$ for (Iterator<Type> it = node.typeArguments().iterator(); it.hasNext();) { Type t = it.next(); t.accept(this); if (it.hasNext()) { this.fBuffer.append(",");//$NON-NLS-1$ }// w ww. j a v a 2 s . c o m } this.fBuffer.append(">");//$NON-NLS-1$ } } this.fBuffer.append("this(");//$NON-NLS-1$ for (Iterator<Expression> it = node.arguments().iterator(); it.hasNext();) { Expression e = it.next(); e.accept(this); if (it.hasNext()) { this.fBuffer.append(",");//$NON-NLS-1$ } } this.fBuffer.append(");");//$NON-NLS-1$ return false; }
From source file:boa.datagen.util.Java7Visitor.java
License:Apache License
@Override public boolean visit(ConstructorInvocation node) { boa.types.Ast.Statement.Builder b = boa.types.Ast.Statement.newBuilder(); // b.setPosition(pos.build()); List<boa.types.Ast.Statement> list = statements.peek(); b.setKind(boa.types.Ast.Statement.StatementKind.EXPRESSION); boa.types.Ast.Expression.Builder eb = boa.types.Ast.Expression.newBuilder(); // eb.setPosition(pos.build());//FIXME eb.setKind(boa.types.Ast.Expression.ExpressionKind.METHODCALL); eb.setMethod("<init>"); for (Object a : node.arguments()) { ((org.eclipse.jdt.core.dom.Expression) a).accept(this); eb.addMethodArgs(expressions.pop()); }/* w ww . ja v a 2s. c om*/ for (Object t : node.typeArguments()) { boa.types.Ast.Type.Builder tb = boa.types.Ast.Type.newBuilder(); tb.setName(getIndex(typeName((org.eclipse.jdt.core.dom.Type) t))); tb.setKind(boa.types.Ast.TypeKind.GENERIC); eb.addGenericParameters(tb.build()); } b.setExpression(eb.build()); list.add(b.build()); return false; }
From source file:coloredide.utils.CopiedNaiveASTFlattener.java
License:Open Source License
public boolean visit(ConstructorInvocation node) { printIndent();/*from w w w.ja va2 s .c o m*/ if (node.getAST().apiLevel() >= AST.JLS3) { if (!node.typeArguments().isEmpty()) { this.buffer.append("<");//$NON-NLS-1$ for (Iterator it = node.typeArguments().iterator(); it.hasNext();) { Type t = (Type) it.next(); t.accept(this); if (it.hasNext()) { this.buffer.append(",");//$NON-NLS-1$ } } this.buffer.append(">");//$NON-NLS-1$ } } this.buffer.append("this(");//$NON-NLS-1$ for (Iterator it = node.arguments().iterator(); it.hasNext();) { Expression e = (Expression) it.next(); e.accept(this); if (it.hasNext()) { this.buffer.append(",");//$NON-NLS-1$ } } this.buffer.append(");\n");//$NON-NLS-1$ return false; }
From source file:com.bsiag.eclipse.jdt.java.formatter.SpacePreparator.java
License:Open Source License
@Override public boolean visit(ConstructorInvocation node) { handleTypeArguments(node.typeArguments()); handleInvocation(node, node);/*from ww w. ja v a2 s. co m*/ handleCommas(node.arguments(), this.options.insert_space_before_comma_in_explicit_constructor_call_arguments, this.options.insert_space_after_comma_in_explicit_constructor_call_arguments); return true; }
From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java
License:Apache License
/** Visitor method for {@link ConstructorInvocation}s. */ @Override/* w ww. j a va 2 s. c o m*/ public boolean visit(ConstructorInvocation node) { sync(node); addTypeArguments(node.typeArguments(), plusFour); token("this"); addArguments(node.arguments(), plusFour); token(";"); return false; }
From source file:lang.java.jdt.internal.JdtAstToRascalAstConverter.java
License:Open Source License
public boolean visit(ConstructorInvocation node) { IValueList types = new IValueList(values); if (node.getAST().apiLevel() >= AST.JLS3) { if (!node.typeArguments().isEmpty()) { for (Iterator it = node.typeArguments().iterator(); it.hasNext();) { Type t = (Type) it.next(); types.add(visitChild(t)); }/*from w w w .j a va 2s .c o m*/ } } IValueList arguments = new IValueList(values); for (Iterator it = node.arguments().iterator(); it.hasNext();) { Expression e = (Expression) it.next(); arguments.add(visitChild(e)); } ownValue = constructRascalNode(node, types.asList(), arguments.asList()); return false; }
From source file:org.codemucker.jmutate.ast.JAstFlattener.java
License:Open Source License
public boolean visit(ConstructorInvocation node) { printIndent();/*from w w w . j ava 2 s . c om*/ if (node.getAST().apiLevel() >= JLS3) { if (!node.typeArguments().isEmpty()) { this.buffer.append("<");//$NON-NLS-1$ for (Iterator it = node.typeArguments().iterator(); it.hasNext();) { Type t = (Type) it.next(); t.accept(this); if (it.hasNext()) { this.buffer.append(",");//$NON-NLS-1$ } } this.buffer.append(">");//$NON-NLS-1$ } } this.buffer.append("this(");//$NON-NLS-1$ for (Iterator it = node.arguments().iterator(); it.hasNext();) { Expression e = (Expression) it.next(); e.accept(this); if (it.hasNext()) { this.buffer.append(",");//$NON-NLS-1$ } } this.buffer.append(");\n");//$NON-NLS-1$ return false; }
From source file:org.eclipse.jdt.core.dom.ASTConverter.java
License:Open Source License
public Statement convert(org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall statement) { Statement newStatement;//w w w . j av a2 s . co m int sourceStart = statement.sourceStart; if (statement.isSuperAccess() || statement.isSuper()) { SuperConstructorInvocation superConstructorInvocation = new SuperConstructorInvocation(this.ast); if (statement.qualification != null) { superConstructorInvocation.setExpression(convert(statement.qualification)); } org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = statement.arguments; if (arguments != null) { int length = arguments.length; for (int i = 0; i < length; i++) { superConstructorInvocation.arguments().add(convert(arguments[i])); } } if (statement.typeArguments != null) { if (sourceStart > statement.typeArgumentsSourceStart) { sourceStart = statement.typeArgumentsSourceStart; } switch (this.ast.apiLevel) { case AST.JLS2_INTERNAL: superConstructorInvocation.setFlags(superConstructorInvocation.getFlags() | ASTNode.MALFORMED); break; default: for (int i = 0, max = statement.typeArguments.length; i < max; i++) { superConstructorInvocation.typeArguments().add(convertType(statement.typeArguments[i])); } break; } } newStatement = superConstructorInvocation; } else { 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])); } } if (statement.typeArguments != null) { if (sourceStart > statement.typeArgumentsSourceStart) { sourceStart = statement.typeArgumentsSourceStart; } switch (this.ast.apiLevel) { case AST.JLS2_INTERNAL: 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])); } break; } } if (statement.qualification != null) { // this is an error constructorInvocation.setFlags(constructorInvocation.getFlags() | ASTNode.MALFORMED); } newStatement = constructorInvocation; } newStatement.setSourceRange(sourceStart, statement.sourceEnd - sourceStart + 1); if (this.resolveBindings) { recordNodes(newStatement, statement); } return newStatement; }
From source file:org.eclipse.modisco.java.discoverer.internal.io.java.JDTVisitor.java
License:Open Source License
@Override public void endVisit(final org.eclipse.jdt.core.dom.ConstructorInvocation node) { ConstructorInvocation element = (ConstructorInvocation) this.binding.get(node); initializeNode(element, node);//from w ww .ja va 2s . com for (Iterator<?> i = node.arguments().iterator(); i.hasNext();) { ASTNode itElement = this.binding.get(i.next()); if (itElement != null) { element.getArguments().add(JDTVisitorUtils.completeExpression(itElement, this)); } } for (Iterator<?> i = node.typeArguments().iterator(); i.hasNext();) { ASTNode itElement = this.binding.get(i.next()); if (itElement != null) { element.getTypeArguments().add(JDTVisitorUtils.completeTypeAccess(itElement, this)); } } PendingElement constructorRef = new PendingElement(this.factory); constructorRef.setClientNode(element); constructorRef.setLinkName("method"); //$NON-NLS-1$ JDTVisitorUtils.manageBindingRef(constructorRef, node, this); }
From source file:org.eclipse.xtend.core.javaconverter.JavaASTFlattener.java
License:Open Source License
@Override public boolean visit(final ConstructorInvocation node) { boolean _isEmpty = node.typeArguments().isEmpty(); boolean _not = (!_isEmpty); if (_not) {/*from ww w .j a v a 2s . c o m*/ this.appendTypeParameters(node.typeArguments()); } this.appendToBuffer("this("); this.visitAllSeparatedByComma(node.arguments()); this.appendToBuffer(")"); return false; }