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

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

Introduction

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

Prototype

public Name getQualifier() 

Source Link

Document

Returns the qualifier of this "super" method invocation expression, or null if there is none.

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 w w .  jav  a2s . 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   ww w  . j a  v a2  s . c  om*/
    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$
    }/*w w w  .ja v  a  2  s.  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.google.devtools.j2objc.ast.DebugASTPrinter.java

License:Apache License

@Override
public boolean visit(SuperMethodInvocation node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        sb.print(".");
    }//w w  w  .  j av  a2  s  .  c  o m
    sb.print("super.");
    printTypeParameters(node.getMethodBinding().getTypeParameters());
    node.getName().accept(this);
    sb.print("(");
    for (Iterator<Expression> it = node.getArguments().iterator(); it.hasNext();) {
        it.next().accept(this);
        if (it.hasNext()) {
            sb.print(',');
        }
    }
    sb.print(")");
    return false;
}

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

License:Apache License

/** Visitor method for {@link SuperMethodInvocation}s. */
@Override/* w  w  w. j  a  v  a 2s.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:com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator.java

License:Open Source License

private CAstNode visit(SuperMethodInvocation n, WalkContext context) {
    CAstNode target;/*from  ww  w . ja  v a2s.c om*/
    if (n.getQualifier() == null)
        target = makeNode(context, fFactory, n, CAstNode.SUPER);
    else {
        TypeReference owningTypeRef = fIdentityMapper.getTypeRef(n.getQualifier().resolveTypeBinding());
        target = makeNode(context, fFactory, n, CAstNode.SUPER, fFactory.makeConstant(owningTypeRef));
    }
    // GENERICS getMethodDeclaration()
    return createMethodInvocation(n, n.resolveMethodBinding().getMethodDeclaration(), target, n.arguments(),
            context);
}

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$
    }/*www. j  a v  a 2  s . co  m*/
    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:edu.cmu.cs.crystal.cfg.eclipse.EclipseCFG.java

License:Open Source License

@Override
public void endVisit(SuperMethodInvocation node) {
    EclipseCFGNode invocation = nodeMap.get(node);
    EclipseCFGNode qual = nodeMap.get(node.getQualifier());

    makeListEdges(qual, (List<ASTNode>) node.arguments(), invocation);
    invocation.setName("Call " + node.getName().getIdentifier());
}

From source file:java5totext.input.JDTVisitor.java

License:Open Source License

@Override
public void endVisit(org.eclipse.jdt.core.dom.SuperMethodInvocation node) {
    SuperMethodInvocation element = (SuperMethodInvocation) this.binding.get(node);
    this.initializeNode(element, node);

    for (Iterator<?> i = node.arguments().iterator(); i.hasNext();) {
        Expression itElement = (Expression) this.binding.get(i.next());
        if (itElement != null)
            element.getArguments().add(itElement);
    }//from   w  ww . ja va  2s.  co  m
    if (this.binding.get(node.getName()) != null)
        element.setMethod((NamedElementRef) this.binding.get(node.getName()));
    if (this.binding.get(node.getQualifier()) != null)
        element.setQualifier((NamedElementRef) this.binding.get(node.getQualifier()));
}

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));
            }/*from w ww.j ava 2s  .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(qualifier), genericTypes.asList(), name, arguments.asList());
    return false;
}