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

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

Introduction

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

Prototype

ASTNode.NodeList arguments

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

Click Source Link

Document

The list of argument expressions (element type: Expression ).

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.  j  a  va 2s . 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   w w w .ja v a2s .  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$
    }/*www. j  av a  2s. c om*/
    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.linewrap.WrapPreparator.java

License:Open Source License

@Override
public boolean visit(SuperMethodInvocation node) {
    handleArguments(node.arguments(), this.options.alignment_for_arguments_in_method_invocation);
    return true;/*from   w  w  w  . ja  va2  s  .com*/
}

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;//from  w  w w.ja  va 2  s  .  c  om
}

From source file:com.google.dart.java2dart.SyntaxTranslator.java

License:Open Source License

@Override
public boolean visit(org.eclipse.jdt.core.dom.SuperMethodInvocation node) {
    IMethodBinding binding = node.resolveMethodBinding();
    Expression target = new SuperExpression(null);
    List<Expression> arguments = translateArguments(binding, node.arguments());
    SimpleIdentifier name = translateSimpleName(node.getName());
    return done(methodInvocation(target, name, arguments));
}

From source file:com.google.devtools.j2cpp.gen.CppStatementGenerator.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override//  www.ja  v a2 s . c o  m
public boolean visit(SuperMethodInvocation node) {
    IMethodBinding binding = Types.getMethodBinding(node);
    if (Modifier.isStatic(binding.getModifiers())) {
        buffer.append("[[super class] ");
    } else {
        buffer.append("[super ");
    }
    buffer.append(NameTable.getName(binding));
    printArguments(binding, node.arguments());
    buffer.append(']');
    return false;
}

From source file:com.google.devtools.j2cpp.translate.JavaToIOSMethodTranslator.java

License:Open Source License

@Override
public boolean visit(SuperMethodInvocation node) {
    // translate any embedded method invocations
    @SuppressWarnings("unchecked")
    List<Expression> args = node.arguments(); // safe by definition
    for (Expression e : args) {
        e.accept(this);
    }/*  w  w w  .j  a  v  a 2  s .c  o m*/

    IMethodBinding binding = Types.getMethodBinding(node);
    JavaMethod md = descriptions.get(binding);
    if (md != null) {
        String key = md.getKey();
        String value = methodMappings.get(key);
        if (value == null) {
            // Method has same name as a mapped method's, but it's ignored since
            // it doesn't override it.
            return super.visit(node);
        }
        IOSMethod iosMethod = new IOSMethod(value, binding, ast);
        node.setName(NameTable.unsafeSimpleName(iosMethod.getName(), ast));
        SimpleName name = node.getName();
        if (name.getIdentifier().equals(binding.getDeclaringClass().getName())
                || name.getIdentifier().equals(binding.getDeclaringClass().getQualifiedName())) {
            node.setName(NameTable.unsafeSimpleName(iosMethod.getDeclaringClass(), ast));
        }
        Types.addMappedIOSMethod(binding, iosMethod);
        IMethodBinding newBinding = iosMethod.resolveBinding();
        Types.addMappedInvocation(node, newBinding);
        Types.addBinding(node, newBinding);
        Types.addBinding(name, newBinding);
    } else {
        // Not mapped, check if it overrides a mapped method.
        for (IMethodBinding methodBinding : mappedMethods) {
            if (binding.overrides(methodBinding)) {
                JavaMethod desc = getDescription(methodBinding);
                String value = methodMappings.get(desc.getKey());
                if (value != null) {
                    IOSMethod iosMethod = new IOSMethod(value, binding, ast);
                    node.setName(NameTable.unsafeSimpleName(iosMethod.getName(), ast));
                    Types.addMappedIOSMethod(binding, iosMethod);
                    IMethodBinding newBinding = iosMethod.resolveBinding();
                    Types.addBinding(node, newBinding);
                    Types.addBinding(node.getName(), newBinding);
                }
            }
        }
    }
    return false;
}

From source file:com.google.devtools.j2cpp.translate.Rewriter.java

License:Open Source License

/**
 * Java interfaces that redeclare java.lang.Object's equals, hashCode, or
 * toString methods need a forwarding method if the implementing class
 * relies on java.lang.Object's implementation.  This is because NSObject
 * is declared as adhering to the NSObject protocol, but doesn't explicitly
 * declare these method in its interface.  This prevents gcc from finding
 * an implementation, so it issues a warning.
 *///  w  ww .  j ava 2  s  .  com
private void addForwardingMethod(AST ast, ITypeBinding typeBinding, IMethodBinding interfaceMethod,
        List<BodyDeclaration> decls) {
    Logger.getAnonymousLogger()
            .fine(String.format("adding %s to %s", interfaceMethod.getName(), typeBinding.getQualifiedName()));
    MethodDeclaration method = createInterfaceMethodBody(ast, typeBinding, interfaceMethod);

    // Add method body with single "super.method(parameters);" statement.
    Block body = ast.newBlock();
    method.setBody(body);
    SuperMethodInvocation superInvocation = ast.newSuperMethodInvocation();
    superInvocation.setName(NodeCopier.copySubtree(ast, method.getName()));

    @SuppressWarnings("unchecked")
    List<SingleVariableDeclaration> parameters = method.parameters(); // safe by design
    @SuppressWarnings("unchecked")
    List<Expression> args = superInvocation.arguments(); // safe by definition
    for (SingleVariableDeclaration param : parameters) {
        Expression arg = NodeCopier.copySubtree(ast, param.getName());
        args.add(arg);
    }
    Types.addBinding(superInvocation, Types.getMethodBinding(method));
    @SuppressWarnings("unchecked")
    List<Statement> stmts = body.statements(); // safe by definition
    ReturnStatement returnStmt = ast.newReturnStatement();
    returnStmt.setExpression(superInvocation);
    stmts.add(returnStmt);

    decls.add(method);
}

From source file:com.google.devtools.j2objc.types.BindingMapVerifier.java

License:Open Source License

@Override
public boolean visit(SuperMethodInvocation node) {
    IBinding binding = bindingMap.get(node);
    assert binding instanceof IMethodBinding;
    IMethodBinding method = (IMethodBinding) binding;
    assert method.isVarargs() || node.arguments().size() == method.getParameterTypes().length
            || binding instanceof IOSMethodBinding;
    return true;/* w ww  .ja v  a  2 s.c o m*/
}