List of usage examples for org.eclipse.jdt.core.dom ConstructorInvocation arguments
ASTNode.NodeList arguments
To view the source code for org.eclipse.jdt.core.dom ConstructorInvocation arguments.
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$ }/*from w w w .j ava 2s . 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 w w .j a v a 2 s .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();/* w w w. ja v a2 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.linewrap.WrapPreparator.java
License:Open Source License
@Override public boolean visit(ConstructorInvocation node) { handleArguments(node.arguments(), this.options.alignment_for_arguments_in_explicit_constructor_call); return true;// w w w .j a v a2s. c om }
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 a 2 s.com 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.dart.java2dart.SyntaxTranslator.java
License:Open Source License
/** * We generate invocation of "impl" method instead of redirecting constructor invocation. The * reason is that in Java it is possible to have "redirecting constructor invocation" as first * statement of constructor and then any other statement. But in Dart redirection should be only * clause.//w w w.j a va 2 s. co m */ @Override public boolean visit(org.eclipse.jdt.core.dom.ConstructorInvocation node) { IMethodBinding binding = node.resolveConstructorBinding(); SimpleIdentifier nameNode = identifier("jtdTmp"); context.getConstructorDescription(binding).implInvocations.add(nameNode); // invoke "impl" List<Expression> arguments = translateArguments(binding, node.arguments()); MethodInvocation invocation = methodInvocation(nameNode, arguments); context.putNodeBinding(invocation, binding); return done(expressionStatement(invocation)); }
From source file:com.google.devtools.j2cpp.gen.CppStatementGenerator.java
License:Open Source License
@SuppressWarnings("unchecked") @Override//from w ww .java 2s . c om public boolean visit(ConstructorInvocation node) { buffer.append("[self init"); printArguments(Types.getMethodBinding(node), node.arguments()); buffer.append("]"); return false; }
From source file:com.google.devtools.j2cpp.translate.Autoboxer.java
License:Open Source License
@Override public void endVisit(ConstructorInvocation node) { @SuppressWarnings("unchecked") List<Expression> args = node.arguments(); // safe by definition convertArguments(Types.getMethodBinding(node), args); }
From source file:com.google.devtools.j2objc.translate.InnerClassExtractorTest.java
License:Open Source License
/** * Verify that a static inner class is extracted. */// w w w .j a v a 2 s. c om public void testStaticInnerClass() { List<AbstractTypeDeclaration> types = translateClassBody( "static class Foo { int i; Foo() { this(0); } Foo(int i) { this.i = i; } }"); assertEquals(2, types.size()); List<BodyDeclaration> classMembers = ASTUtil.getBodyDeclarations(types.get(0)); assertTrue(classMembers.size() == 1); AbstractTypeDeclaration innerClass = types.get(1); assertEquals(4, innerClass.bodyDeclarations().size()); List<BodyDeclaration> members = ASTUtil.getBodyDeclarations(innerClass); FieldDeclaration field = (FieldDeclaration) members.get(0); assertEquals("int", field.getType().toString()); MethodDeclaration method = (MethodDeclaration) members.get(1); assertTrue(method.isConstructor()); assertTrue(method.parameters().isEmpty()); assertEquals(1, method.getBody().statements().size()); ConstructorInvocation stmt = (ConstructorInvocation) method.getBody().statements().get(0); assertEquals(1, stmt.arguments().size()); method = (MethodDeclaration) members.get(2); assertTrue(method.isConstructor()); assertEquals(1, method.parameters().size()); assertEquals(2, method.getBody().statements().size()); ExpressionStatement expr = (ExpressionStatement) method.getBody().statements().get(1); assertTrue(expr.getExpression() instanceof Assignment); }
From source file:com.google.devtools.j2objc.util.ASTUtil.java
License:Apache License
@SuppressWarnings("unchecked") public static List<Expression> getArguments(ConstructorInvocation node) { return node.arguments(); }