Java Code Examples for org.eclipse.jdt.core.dom.SuperMethodInvocation#getQualifier()

The following examples show how to use org.eclipse.jdt.core.dom.SuperMethodInvocation#getQualifier() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaASTFlattener.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public boolean visit(final SuperMethodInvocation node) {
  Name _qualifier = node.getQualifier();
  boolean _tripleNotEquals = (_qualifier != null);
  if (_tripleNotEquals) {
    node.getQualifier().accept(this);
    this.appendToBuffer(".");
  }
  this.appendToBuffer("super.");
  boolean _isEmpty = node.typeArguments().isEmpty();
  boolean _not = (!_isEmpty);
  if (_not) {
    this.appendTypeParameters(node.typeArguments());
  }
  node.getName().accept(this);
  this.appendToBuffer("(");
  this.visitAllSeparatedByComma(node.arguments());
  this.appendToBuffer(")");
  return false;
}
 
Example 2
Source File: StyledStringVisitor.java    From JDeodorant with MIT License 6 votes vote down vote up
public boolean visit(SuperMethodInvocation expr) {
	/*
	  SuperMethodInvocation: [ ClassName . ] super . [ < Type { , Type } >
	 	] Identifier ( [ Expression { , Expression } ] )
	 */
	activateDiffStyle(expr);
	if (expr.getQualifier() != null) {
		handleExpression(expr.getQualifier());
		appendPeriod();
	}
	styledString.append("super", determineDiffStyle(expr, new StyledStringStyler(keywordStyle)));
	appendPeriod();
	handleTypeArguments(expr.typeArguments());
	handleExpression((Expression) expr.getName());
	handleParameters(expr.arguments());
	deactivateDiffStyle(expr);
	return false;
}
 
Example 3
Source File: SuperMethodInvocationWriter.java    From juniversal with MIT License 6 votes vote down vote up
@Override
public void write(SuperMethodInvocation superMethodInvocation) {
    // TODO: Support this
    if (superMethodInvocation.getQualifier() != null)
        throw sourceNotSupported("Qualified super invocations aren't currently supported");

    matchAndWrite("super", "base");

    copySpaceAndComments();
    matchAndWrite(".");

    copySpaceAndComments();
    writeMethodInvocation(superMethodInvocation, null,
            superMethodInvocation.getName(), superMethodInvocation.typeArguments(),
            superMethodInvocation.arguments(), superMethodInvocation.resolveMethodBinding());
}
 
Example 4
Source File: MethodInvocationWriter.java    From juniversal with MIT License 6 votes vote down vote up
@Override
public void write(ASTNode node) {
	if (node instanceof SuperMethodInvocation) {
		SuperMethodInvocation superMethodInvocation = (SuperMethodInvocation) node;

		if (superMethodInvocation.getQualifier() != null)
			throw sourceNotSupported("Super method invocations with qualifiers before super aren't currently supported");

		writeMethodInvocation(true, null, superMethodInvocation.resolveMethodBinding(),
				superMethodInvocation.getName(), superMethodInvocation.typeArguments(),
				superMethodInvocation.arguments());
	} else if (node instanceof MethodInvocation) {
		MethodInvocation methodInvocation = (MethodInvocation) node;

		writeMethodInvocation(false, methodInvocation.getExpression(), methodInvocation.resolveMethodBinding(),
				methodInvocation.getName(), methodInvocation.typeArguments(), methodInvocation.arguments());
	}
}
 
Example 5
Source File: CodeBlock.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
private SuperMethodInv visit(SuperMethodInvocation node) {
	int startLine = _cunit.getLineNumber(node.getStartPosition());
	int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength());
	SuperMethodInv superMethodInv = new SuperMethodInv(startLine, endLine, node);
	
	superMethodInv.setName(node.getName().getFullyQualifiedName());
	
	if(node.getQualifier() != null){
		Label label = (Label) process(node.getQualifier());
		label.setParent(superMethodInv);
		superMethodInv.setLabel(label);
	}
	
	List<Expr> arguments = new ArrayList<>();
	for(Object object : node.arguments()){
		Expr expr = (Expr) process((ASTNode) object);
		expr.setParent(superMethodInv);
		arguments.add(expr);
	}
	superMethodInv.setArguments(arguments);
	
	Pair<String, String> pair = NodeUtils.getTypeDecAndMethodDec(node);
	Type type = ProjectInfo.getMethodRetType(pair.getFirst(), pair.getSecond());
	superMethodInv.setType(type);
	
	return superMethodInv;
}
 
Example 6
Source File: LambdaExpressionsFix.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean visit(SuperMethodInvocation node) {
	if (node.getQualifier() == null) {
		throw new AbortSearchException();
	} else {
		IBinding qualifierType= node.getQualifier().resolveBinding();
		if (qualifierType instanceof ITypeBinding && ((ITypeBinding) qualifierType).isInterface()) {
			throw new AbortSearchException(); // JLS8: new overloaded meaning of 'interface'.super.'method'(..)
		}
	}
	return true; // references to outer scopes are harmless
}
 
Example 7
Source File: BindingSignatureVisitor.java    From JDeodorant with MIT License 5 votes vote down vote up
public boolean visit(SuperMethodInvocation expr) {
	if (expr.getQualifier() != null) {
		handleExpression(expr.getQualifier());
	}
	List typeArguments = expr.typeArguments();
	for (int i = 0; i < typeArguments.size(); i++) {
		handleType((Type) typeArguments.get(i));
	}
	handleExpression(expr.getName());
	handleParameters(expr.arguments());
	return false;
}