List of usage examples for org.eclipse.jdt.core.dom MethodInvocation typeArguments
ASTNode.NodeList typeArguments
To view the source code for org.eclipse.jdt.core.dom MethodInvocation typeArguments.
Click Source Link
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(MethodInvocation node) { if (node.getExpression() != null) { node.getExpression().accept(this); this.fBuffer.append(".");//$NON-NLS-1$ }//from w w w . j a v a 2s . c o m 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$ } } this.fBuffer.append(">");//$NON-NLS-1$ } } node.getName().accept(this); this.fBuffer.append("(");//$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(MethodInvocation node) { boa.types.Ast.Expression.Builder b = boa.types.Ast.Expression.newBuilder(); // b.setPosition(pos.build()); b.setKind(boa.types.Ast.Expression.ExpressionKind.METHODCALL); b.setMethod(node.getName().getFullyQualifiedName()); if (node.getExpression() != null) { node.getExpression().accept(this); b.addExpressions(expressions.pop()); }//from w w w . j a va 2 s .co m for (Object a : node.arguments()) { ((org.eclipse.jdt.core.dom.Expression) a).accept(this); b.addMethodArgs(expressions.pop()); } 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); b.addGenericParameters(tb.build()); } expressions.push(b.build()); return false; }
From source file:coloredide.utils.CopiedNaiveASTFlattener.java
License:Open Source License
public boolean visit(MethodInvocation node) { if (node.getExpression() != null) { node.getExpression().accept(this); this.buffer.append(".");//$NON-NLS-1$ }/*ww w. j a v a2s. 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$ } } node.getName().accept(this); this.buffer.append("(");//$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(")");//$NON-NLS-1$ return false; }
From source file:com.bsiag.eclipse.jdt.java.formatter.SpacePreparator.java
License:Open Source License
@Override public boolean visit(MethodInvocation node) { handleTypeArguments(node.typeArguments()); handleInvocation(node, node.getName()); handleCommas(node.arguments(), this.options.insert_space_before_comma_in_method_invocation_arguments, this.options.insert_space_after_comma_in_method_invocation_arguments); return true;//w w w .j ava 2 s . c om }
From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java
License:Apache License
private void dotExpressionUpToArgs(Expression expression, Optional<BreakTag> tyargTag) { switch (expression.getNodeType()) { case ASTNode.FIELD_ACCESS: FieldAccess fieldAccess = (FieldAccess) expression; visit(fieldAccess.getName());//from www .j av a2s . co m break; case ASTNode.METHOD_INVOCATION: MethodInvocation methodInvocation = (MethodInvocation) expression; if (!methodInvocation.typeArguments().isEmpty()) { builder.open(plusFour); addTypeArguments(methodInvocation.typeArguments(), ZERO); // TODO(jdd): Should indent the name -4. builder.breakOp(Doc.FillMode.UNIFIED, "", ZERO, tyargTag); builder.close(); } visit(methodInvocation.getName()); break; case ASTNode.QUALIFIED_NAME: visit(((QualifiedName) expression).getName()); break; case ASTNode.SIMPLE_NAME: visit(((SimpleName) expression)); break; default: expression.accept(this); } }
From source file:lang.java.jdt.internal.JdtAstToRascalAstConverter.java
License:Open Source License
public boolean visit(MethodInvocation node) { IValue expression = node.getExpression() == null ? null : visitChild(node.getExpression()); IValueList genericTypes = 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(); genericTypes.add(visitChild(t)); }//from w ww . j av a2 s . c om } } IValue name = values.string(node.getName().getFullyQualifiedName()); 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, optional(expression), genericTypes.asList(), name, arguments.asList()); return false; }
From source file:org.autorefactor.refactoring.ASTHelper.java
License:Open Source License
/** * Generecized version of the equivalent JDT method. * * @param node the node on which to call the equivalent JDT method * @return a List of expressions//from ww w . jav a2 s .co m * @see ParameterizedType#typeArguments() */ @SuppressWarnings("unchecked") public static List<Type> typeArguments(MethodInvocation node) { return node.typeArguments(); }
From source file:org.autorefactor.refactoring.rules.ReplaceQualifiedNamesBySimpleNamesRefactoring.java
License:Open Source License
@Override public boolean visit(MethodInvocation node) { final Expression expr = node.getExpression(); final IMethodBinding methodBinding = node.resolveMethodBinding(); if (methodBinding != null && expr instanceof Name && hasKind(((Name) expr), TYPE) && node.typeArguments().isEmpty()) { final ITypeBinding declaringClass = methodBinding.getDeclaringClass(); final QName qname = QName.valueOf(declaringClass.getErasure().getQualifiedName(), methodBinding.getName()); if (methods.canReplaceFqnWithSimpleName(node, qname, FqnType.METHOD)) { ctx.getRefactorings().remove(expr); return DO_NOT_VISIT_SUBTREE; }/* www. ja va2 s. c o m*/ } return VISIT_SUBTREE; }
From source file:org.autorefactor.refactoring.rules.SimpleNameRatherThanQualifiedNameRefactoring.java
License:Open Source License
@Override public boolean visit(MethodInvocation node) { final Expression expr = node.getExpression(); final IMethodBinding methodBinding = node.resolveMethodBinding(); if (methodBinding != null && expr instanceof Name && hasKind((Name) expr, TYPE) && node.typeArguments().isEmpty()) { final ITypeBinding declaringClass = methodBinding.getDeclaringClass(); final QName qname = QName.valueOf(declaringClass.getErasure().getQualifiedName(), methodBinding.getName()); if (methods.canReplaceFqnWithSimpleName(node, qname, FqnType.METHOD)) { ctx.getRefactorings().remove(expr); return DO_NOT_VISIT_SUBTREE; }//from www. ja v a2s . c om } return VISIT_SUBTREE; }
From source file:org.codemucker.jmutate.ast.JAstFlattener.java
License:Open Source License
public boolean visit(MethodInvocation node) { if (node.getExpression() != null) { node.getExpression().accept(this); this.buffer.append(".");//$NON-NLS-1$ }//from w w w.ja v a 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$ } } node.getName().accept(this); this.buffer.append("(");//$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(")");//$NON-NLS-1$ return false; }