Example usage for org.eclipse.jdt.core.dom SuperMethodInvocation typeArguments

List of usage examples for org.eclipse.jdt.core.dom SuperMethodInvocation typeArguments

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom SuperMethodInvocation typeArguments.

Prototype

ASTNode.NodeList typeArguments

To view the source code for org.eclipse.jdt.core.dom SuperMethodInvocation typeArguments.

Click Source Link

Document

The type arguments (element type: Type ).

Usage

From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java

License:Open Source License

@Override
public boolean visit(SuperMethodInvocation node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        this.fBuffer.append(".");//$NON-NLS-1$
    }//w  ww. j  av a 2  s .c o  m
    this.fBuffer.append("super.");//$NON-NLS-1$
    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(SuperMethodInvocation node) {
    boa.types.Ast.Expression.Builder b = boa.types.Ast.Expression.newBuilder();
    //      b.setPosition(pos.build());
    b.setKind(boa.types.Ast.Expression.ExpressionKind.METHODCALL);
    String name = "super." + node.getName().getFullyQualifiedName();
    if (node.getQualifier() != null)
        name = node.getQualifier().getFullyQualifiedName() + "." + name;
    b.setMethod(name);/*from   www .jav a  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(SuperMethodInvocation node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        this.buffer.append(".");//$NON-NLS-1$
    }//from   w w  w . jav a 2s .  c  o  m
    this.buffer.append("super.");//$NON-NLS-1$
    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(SuperMethodInvocation 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 a v a 2s . com*/
}

From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java

License:Apache License

/** Visitor method for {@link SuperMethodInvocation}s. */
@Override//from   w ww.  j a v a2 s.  c  o  m
public boolean visit(SuperMethodInvocation node) {
    sync(node);
    builder.open(ZERO);
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        builder.breakOp();
        token(".");
    }
    token("super");
    builder.breakOp();
    token(".");
    builder.close();
    addTypeArguments(node.typeArguments(), plusFour);
    visit(node.getName());
    addArguments(node.arguments(), plusFour);
    return false;
}

From source file:de.ovgu.cide.export.physical.ahead.JakPrettyPrinter.java

License:Open Source License

public boolean visit(SuperMethodInvocation node) {
    if (!SuperCallHelper.isSuperLayerCall(node))
        return super.visit(node);

    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        this.buffer.append(".");//$NON-NLS-1$
    }/*from  ww w.  j a v  a 2 s .  com*/
    this.buffer.append("Super(");//$NON-NLS-1$
    String types = SuperTypeHelper.getCachedTypes(node);
    this.buffer.append(types);
    this.buffer.append(").");//$NON-NLS-1$
    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:lang.java.jdt.internal.JdtAstToRascalAstConverter.java

License:Open Source License

public boolean visit(SuperMethodInvocation node) {
    IValue qualifier = node.getQualifier() == null ? null : visitChild(node.getQualifier());

    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));
            }// w w  w. j  av  a2 s .  c o m
        }
    }

    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(qualifier), genericTypes.asList(), name, arguments.asList());
    return false;
}

From source file:org.codemucker.jmutate.ast.JAstFlattener.java

License:Open Source License

public boolean visit(SuperMethodInvocation node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        this.buffer.append(".");//$NON-NLS-1$
    }/*from  ww w  .ja  v  a 2 s. co m*/
    this.buffer.append("super.");//$NON-NLS-1$
    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;
}

From source file:org.eclipse.jdt.core.dom.ASTConverter.java

License:Open Source License

public Expression convert(MessageSend expression) {
    // will return a MethodInvocation or a SuperMethodInvocation or
    Expression expr;//w  w w.j  a  va  2 s .c om
    int sourceStart = expression.sourceStart;
    if (expression.isSuperAccess()) {
        // returns a SuperMethodInvocation
        final SuperMethodInvocation superMethodInvocation = new SuperMethodInvocation(this.ast);
        if (this.resolveBindings) {
            recordNodes(superMethodInvocation, expression);
        }
        final SimpleName name = new SimpleName(this.ast);
        name.internalSetIdentifier(new String(expression.selector));
        int nameSourceStart = (int) (expression.nameSourcePosition >>> 32);
        int nameSourceLength = ((int) expression.nameSourcePosition) - nameSourceStart + 1;
        name.setSourceRange(nameSourceStart, nameSourceLength);
        if (this.resolveBindings) {
            recordNodes(name, expression);
        }
        superMethodInvocation.setName(name);
        // expression.receiver is either a QualifiedSuperReference or a SuperReference
        // so the casting cannot fail
        if (expression.receiver instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) {
            Name qualifier = convert(
                    (org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) expression.receiver);
            superMethodInvocation.setQualifier(qualifier);
            if (this.resolveBindings) {
                recordNodes(qualifier, expression.receiver);
            }
            if (qualifier != null) {
                sourceStart = qualifier.getStartPosition();
            }
        }
        org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = expression.arguments;
        if (arguments != null) {
            int argumentsLength = arguments.length;
            for (int i = 0; i < argumentsLength; i++) {
                Expression expri = convert(arguments[i]);
                if (this.resolveBindings) {
                    recordNodes(expri, arguments[i]);
                }
                superMethodInvocation.arguments().add(expri);
            }
        }
        final TypeReference[] typeArguments = expression.typeArguments;
        if (typeArguments != null) {
            switch (this.ast.apiLevel) {
            case AST.JLS2_INTERNAL:
                superMethodInvocation.setFlags(superMethodInvocation.getFlags() | ASTNode.MALFORMED);
                break;
            default:
                for (int i = 0, max = typeArguments.length; i < max; i++) {
                    superMethodInvocation.typeArguments().add(convertType(typeArguments[i]));
                }
                break;
            }
        }
        expr = superMethodInvocation;
    } else {
        // returns a MethodInvocation
        final MethodInvocation methodInvocation = new MethodInvocation(this.ast);
        if (this.resolveBindings) {
            recordNodes(methodInvocation, expression);
        }
        final SimpleName name = new SimpleName(this.ast);
        name.internalSetIdentifier(new String(expression.selector));
        int nameSourceStart = (int) (expression.nameSourcePosition >>> 32);
        int nameSourceLength = ((int) expression.nameSourcePosition) - nameSourceStart + 1;
        name.setSourceRange(nameSourceStart, nameSourceLength);
        methodInvocation.setName(name);
        if (this.resolveBindings) {
            recordNodes(name, expression);
        }
        org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = expression.arguments;
        if (arguments != null) {
            int argumentsLength = arguments.length;
            for (int i = 0; i < argumentsLength; i++) {
                Expression expri = convert(arguments[i]);
                if (this.resolveBindings) {
                    recordNodes(expri, arguments[i]);
                }
                methodInvocation.arguments().add(expri);
            }
        }
        Expression qualifier = null;
        org.eclipse.jdt.internal.compiler.ast.Expression receiver = expression.receiver;
        if (receiver instanceof MessageSend) {
            if ((receiver.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedMASK) != 0) {
                qualifier = convertToParenthesizedExpression(receiver);
            } else {
                qualifier = convert((MessageSend) receiver);
            }
        } else {
            qualifier = convert(receiver);
        }
        if (qualifier instanceof Name && this.resolveBindings) {
            recordNodes(qualifier, receiver);
        }
        methodInvocation.setExpression(qualifier);
        if (qualifier != null) {
            sourceStart = qualifier.getStartPosition();
        }
        final TypeReference[] typeArguments = expression.typeArguments;
        if (typeArguments != null) {
            switch (this.ast.apiLevel) {
            case AST.JLS2_INTERNAL:
                methodInvocation.setFlags(methodInvocation.getFlags() | ASTNode.MALFORMED);
                break;
            default:
                for (int i = 0, max = typeArguments.length; i < max; i++) {
                    methodInvocation.typeArguments().add(convertType(typeArguments[i]));
                }
                break;
            }
        }
        expr = methodInvocation;
    }
    expr.setSourceRange(sourceStart, expression.sourceEnd - sourceStart + 1);
    removeTrailingCommentFromExpressionEndingWithAParen(expr);
    return expr;
}

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.SuperMethodInvocation node) {
    SuperMethodInvocation element = (SuperMethodInvocation) this.binding.get(node);
    initializeNode(element, node);/*from   w w  w.  j a v a2 s  .  c  om*/

    ASTNode modiscoNode = null;

    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));
        }
    }

    modiscoNode = this.binding.get(node.getName());
    if (JDTVisitorUtils.completeBinding(element, modiscoNode, "method")) { //$NON-NLS-1$
        element.setMethod((AbstractMethodDeclaration) modiscoNode);
    }

    if (this.binding.get(node.getQualifier()) != null) {
        element.setQualifier(JDTVisitorUtils.completeTypeAccess(this.binding.get(node.getQualifier()), this));
    }
}