org.eclipse.jdt.core.dom.SuperMethodInvocation Java Examples
The following examples show how to use
org.eclipse.jdt.core.dom.SuperMethodInvocation.
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: SuperTypeConstraintsCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public final void endVisit(final SuperMethodInvocation node) { final IMethodBinding superBinding= node.resolveMethodBinding(); if (superBinding != null) { endVisit(node.arguments(), superBinding); final MethodDeclaration declaration= fCurrentMethods.peek(); if (declaration != null) { final IMethodBinding subBinding= declaration.resolveBinding(); if (subBinding != null) { final ConstraintVariable2 ancestor= fModel.createReturnTypeVariable(superBinding); if (ancestor != null) { node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor); final ConstraintVariable2 descendant= fModel.createReturnTypeVariable(subBinding); if (descendant != null) fModel.createEqualityConstraint(descendant, ancestor); } } } } }
Example #2
Source File: NewMethodCorrectionProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected SimpleName getNewName(ASTRewrite rewrite) { ASTNode invocationNode= getInvocationNode(); String name; if (invocationNode instanceof MethodInvocation) { name= ((MethodInvocation)invocationNode).getName().getIdentifier(); } else if (invocationNode instanceof SuperMethodInvocation) { name= ((SuperMethodInvocation)invocationNode).getName().getIdentifier(); } else { name= getSenderBinding().getName(); // name of the class } AST ast= rewrite.getAST(); SimpleName newNameNode= ast.newSimpleName(name); addLinkedPosition(rewrite.track(newNameNode), false, KEY_NAME); ASTNode invocationName= getInvocationNameNode(); if (invocationName != null && invocationName.getAST() == ast) { // in the same CU addLinkedPosition(rewrite.track(invocationName), true, KEY_NAME); } return newNameNode; }
Example #3
Source File: ImplementationsHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
private boolean shouldIncludeDefinition(ITypeRoot typeRoot, IRegion region, IJavaElement elementToSearch, List<Location> implementations) { boolean isUnimplemented = false; try { isUnimplemented = isUnimplementedMember(elementToSearch); } catch (JavaModelException e) { // do nothing. } if (isUnimplemented && implementations != null && !implementations.isEmpty()) { return false; } CompilationUnit ast = CoreASTProvider.getInstance().getAST(typeRoot, CoreASTProvider.WAIT_YES, new NullProgressMonitor()); if (ast == null) { return false; } ASTNode node = NodeFinder.perform(ast, region.getOffset(), region.getLength()); if (node instanceof SimpleName && !(node.getParent() instanceof MethodDeclaration || node.getParent() instanceof SuperMethodInvocation || node.getParent() instanceof AbstractTypeDeclaration)) { return true; } return false; }
Example #4
Source File: MethodInvocationWriter.java From juniversal with MIT License | 6 votes |
@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: StyledStringVisitor.java From JDeodorant with MIT License | 6 votes |
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 #6
Source File: SuperMethodInvocationWriter.java From juniversal with MIT License | 6 votes |
@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 #7
Source File: ASTNodeMatcher.java From JDeodorant with MIT License | 6 votes |
protected boolean isTypeHolder(Object o) { if(o.getClass().equals(MethodInvocation.class) || o.getClass().equals(SuperMethodInvocation.class) || o.getClass().equals(NumberLiteral.class) || o.getClass().equals(StringLiteral.class) || o.getClass().equals(CharacterLiteral.class) || o.getClass().equals(BooleanLiteral.class) || o.getClass().equals(TypeLiteral.class) || o.getClass().equals(NullLiteral.class) || o.getClass().equals(ArrayCreation.class) || o.getClass().equals(ClassInstanceCreation.class) || o.getClass().equals(ArrayAccess.class) || o.getClass().equals(FieldAccess.class) || o.getClass().equals(SuperFieldAccess.class) || o.getClass().equals(ParenthesizedExpression.class) || o.getClass().equals(SimpleName.class) || o.getClass().equals(QualifiedName.class) || o.getClass().equals(CastExpression.class) || o.getClass().equals(InfixExpression.class) || o.getClass().equals(PrefixExpression.class) || o.getClass().equals(InstanceofExpression.class) || o.getClass().equals(ThisExpression.class) || o.getClass().equals(ConditionalExpression.class)) return true; return false; }
Example #8
Source File: CreateSuperCallResolution.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void repairBug(ASTRewrite rewrite, CompilationUnit workingUnit, BugInstance bug) throws BugResolutionException { Assert.isNotNull(rewrite); Assert.isNotNull(workingUnit); Assert.isNotNull(bug); TypeDeclaration type = getTypeDeclaration(workingUnit, bug.getPrimaryClass()); MethodDeclaration method = getMethodDeclaration(type, bug.getPrimaryMethod()); AST ast = rewrite.getAST(); SuperMethodInvocation superCall = createSuperMethodInvocation(rewrite, method); ExpressionStatement statement = ast.newExpressionStatement(superCall); Block methodBody = method.getBody(); ListRewrite listRewrite = rewrite.getListRewrite(methodBody, Block.STATEMENTS_PROPERTY); if (isInsertFirst()) { listRewrite.insertFirst(statement, null); } else { listRewrite.insertLast(statement, null); } }
Example #9
Source File: ExpressionVariable.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public static IBinding resolveBinding(Expression expression){ if (expression instanceof Name) return ((Name)expression).resolveBinding(); if (expression instanceof ParenthesizedExpression) return resolveBinding(((ParenthesizedExpression)expression).getExpression()); else if (expression instanceof Assignment) return resolveBinding(((Assignment)expression).getLeftHandSide());//TODO ??? else if (expression instanceof MethodInvocation) return ((MethodInvocation)expression).resolveMethodBinding(); else if (expression instanceof SuperMethodInvocation) return ((SuperMethodInvocation)expression).resolveMethodBinding(); else if (expression instanceof FieldAccess) return ((FieldAccess)expression).resolveFieldBinding(); else if (expression instanceof SuperFieldAccess) return ((SuperFieldAccess)expression).resolveFieldBinding(); else if (expression instanceof ConditionalExpression) return resolveBinding(((ConditionalExpression)expression).getThenExpression()); return null; }
Example #10
Source File: InlineMethodRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public RefactoringStatus setCurrentMode(Mode mode) throws JavaModelException { if (fCurrentMode == mode) return new RefactoringStatus(); Assert.isTrue(getInitialMode() == Mode.INLINE_SINGLE); fCurrentMode= mode; if (mode == Mode.INLINE_SINGLE) { if (fInitialNode instanceof MethodInvocation) fTargetProvider= TargetProvider.create((ICompilationUnit) fInitialTypeRoot, (MethodInvocation)fInitialNode); else if (fInitialNode instanceof SuperMethodInvocation) fTargetProvider= TargetProvider.create((ICompilationUnit) fInitialTypeRoot, (SuperMethodInvocation)fInitialNode); else if (fInitialNode instanceof ConstructorInvocation) fTargetProvider= TargetProvider.create((ICompilationUnit) fInitialTypeRoot, (ConstructorInvocation)fInitialNode); else throw new IllegalStateException(String.valueOf(fInitialNode)); } else { fTargetProvider= TargetProvider.create(fSourceProvider.getDeclaration()); } return fTargetProvider.checkActivation(); }
Example #11
Source File: Invocations.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public static ITypeBinding[] getInferredTypeArguments(Expression invocation) { IMethodBinding methodBinding; switch (invocation.getNodeType()) { case ASTNode.METHOD_INVOCATION: methodBinding= ((MethodInvocation) invocation).resolveMethodBinding(); return methodBinding == null ? null : methodBinding.getTypeArguments(); case ASTNode.SUPER_METHOD_INVOCATION: methodBinding= ((SuperMethodInvocation) invocation).resolveMethodBinding(); return methodBinding == null ? null : methodBinding.getTypeArguments(); case ASTNode.CLASS_INSTANCE_CREATION: Type type= ((ClassInstanceCreation) invocation).getType(); ITypeBinding typeBinding= type.resolveBinding(); return typeBinding == null ? null : typeBinding.getTypeArguments(); default: throw new IllegalArgumentException(invocation.toString()); } }
Example #12
Source File: JavaASTFlattener.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@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 #13
Source File: IntroduceParameterObjectProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected boolean shouldReport(IProblem problem, CompilationUnit cu) { if (!super.shouldReport(problem, cu)) return false; ASTNode node= ASTNodeSearchUtil.getAstNode(cu, problem.getSourceStart(), problem.getSourceEnd() - problem.getSourceStart() + 1); if (node instanceof Type) { Type type= (Type) node; if (problem.getID() == IProblem.UndefinedType && getClassName().equals(ASTNodes.getTypeName(type))) { return false; } } if (node instanceof Name) { Name name= (Name) node; if (problem.getID() == IProblem.ImportNotFound && getPackage().indexOf(name.getFullyQualifiedName()) != -1) return false; if (problem.getID() == IProblem.MissingTypeInMethod) { StructuralPropertyDescriptor locationInParent= name.getLocationInParent(); String[] arguments= problem.getArguments(); if ((locationInParent == MethodInvocation.NAME_PROPERTY || locationInParent == SuperMethodInvocation.NAME_PROPERTY) && arguments.length > 3 && arguments[3].endsWith(getClassName())) return false; } } return true; }
Example #14
Source File: RefactoringAvailabilityTester.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private static ASTNode getInlineableMethodNode(ASTNode node, IJavaElement unit) { if (node == null) return null; switch (node.getNodeType()) { case ASTNode.SIMPLE_NAME: StructuralPropertyDescriptor locationInParent= node.getLocationInParent(); if (locationInParent == MethodDeclaration.NAME_PROPERTY) { return node.getParent(); } else if (locationInParent == MethodInvocation.NAME_PROPERTY || locationInParent == SuperMethodInvocation.NAME_PROPERTY) { return unit instanceof ICompilationUnit ? node.getParent() : null; // don't start on invocations in binary } return null; case ASTNode.EXPRESSION_STATEMENT: node= ((ExpressionStatement)node).getExpression(); } switch (node.getNodeType()) { case ASTNode.METHOD_DECLARATION: return node; case ASTNode.METHOD_INVOCATION: case ASTNode.SUPER_METHOD_INVOCATION: case ASTNode.CONSTRUCTOR_INVOCATION: return unit instanceof ICompilationUnit ? node : null; // don't start on invocations in binary } return null; }
Example #15
Source File: Invocations.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public static List<Expression> getArguments(ASTNode invocation) { switch (invocation.getNodeType()) { case ASTNode.METHOD_INVOCATION: return ((MethodInvocation)invocation).arguments(); case ASTNode.SUPER_METHOD_INVOCATION: return ((SuperMethodInvocation)invocation).arguments(); case ASTNode.CONSTRUCTOR_INVOCATION: return ((ConstructorInvocation)invocation).arguments(); case ASTNode.SUPER_CONSTRUCTOR_INVOCATION: return ((SuperConstructorInvocation)invocation).arguments(); case ASTNode.CLASS_INSTANCE_CREATION: return ((ClassInstanceCreation)invocation).arguments(); case ASTNode.ENUM_CONSTANT_DECLARATION: return ((EnumConstantDeclaration)invocation).arguments(); default: throw new IllegalArgumentException(invocation.toString()); } }
Example #16
Source File: Invocations.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public static ChildListPropertyDescriptor getArgumentsProperty(ASTNode invocation) { switch (invocation.getNodeType()) { case ASTNode.METHOD_INVOCATION: return MethodInvocation.ARGUMENTS_PROPERTY; case ASTNode.SUPER_METHOD_INVOCATION: return SuperMethodInvocation.ARGUMENTS_PROPERTY; case ASTNode.CONSTRUCTOR_INVOCATION: return ConstructorInvocation.ARGUMENTS_PROPERTY; case ASTNode.SUPER_CONSTRUCTOR_INVOCATION: return SuperConstructorInvocation.ARGUMENTS_PROPERTY; case ASTNode.CLASS_INSTANCE_CREATION: return ClassInstanceCreation.ARGUMENTS_PROPERTY; case ASTNode.ENUM_CONSTANT_DECLARATION: return EnumConstantDeclaration.ARGUMENTS_PROPERTY; default: throw new IllegalArgumentException(invocation.toString()); } }
Example #17
Source File: Invocations.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public static IMethodBinding resolveBinding(ASTNode invocation) { switch (invocation.getNodeType()) { case ASTNode.METHOD_INVOCATION: return ((MethodInvocation)invocation).resolveMethodBinding(); case ASTNode.SUPER_METHOD_INVOCATION: return ((SuperMethodInvocation)invocation).resolveMethodBinding(); case ASTNode.CONSTRUCTOR_INVOCATION: return ((ConstructorInvocation)invocation).resolveConstructorBinding(); case ASTNode.SUPER_CONSTRUCTOR_INVOCATION: return ((SuperConstructorInvocation)invocation).resolveConstructorBinding(); case ASTNode.CLASS_INSTANCE_CREATION: return ((ClassInstanceCreation)invocation).resolveConstructorBinding(); case ASTNode.ENUM_CONSTANT_DECLARATION: return ((EnumConstantDeclaration)invocation).resolveConstructorBinding(); default: throw new IllegalArgumentException(invocation.toString()); } }
Example #18
Source File: Invocations.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public static boolean isResolvedTypeInferredFromExpectedType(Expression invocation) { if (invocation == null) return false; switch (invocation.getNodeType()) { case ASTNode.METHOD_INVOCATION: return ((MethodInvocation) invocation).isResolvedTypeInferredFromExpectedType(); case ASTNode.SUPER_METHOD_INVOCATION: return ((SuperMethodInvocation) invocation).isResolvedTypeInferredFromExpectedType(); case ASTNode.CLASS_INSTANCE_CREATION: return ((ClassInstanceCreation) invocation).isResolvedTypeInferredFromExpectedType(); default: return false; } }
Example #19
Source File: InlineMethodRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Creates a new inline method refactoring * @param unit the compilation unit or class file * @param node the compilation unit node * @param selectionStart start * @param selectionLength length * @return returns the refactoring */ public static InlineMethodRefactoring create(ITypeRoot unit, CompilationUnit node, int selectionStart, int selectionLength) { ASTNode target= RefactoringAvailabilityTester.getInlineableMethodNode(unit, node, selectionStart, selectionLength); if (target == null) return null; if (target.getNodeType() == ASTNode.METHOD_DECLARATION) { return new InlineMethodRefactoring(unit, (MethodDeclaration)target, selectionStart, selectionLength); } else { ICompilationUnit cu= (ICompilationUnit) unit; if (target.getNodeType() == ASTNode.METHOD_INVOCATION) { return new InlineMethodRefactoring(cu, (MethodInvocation)target, selectionStart, selectionLength); } else if (target.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION) { return new InlineMethodRefactoring(cu, (SuperMethodInvocation)target, selectionStart, selectionLength); } else if (target.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION) { return new InlineMethodRefactoring(cu, (ConstructorInvocation)target, selectionStart, selectionLength); } } return null; }
Example #20
Source File: PullUpRefactoringProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public final boolean visit(final SuperMethodInvocation node) { if (!fAnonymousClassDeclaration && !fTypeDeclarationStatement) { final IBinding superBinding= node.getName().resolveBinding(); if (superBinding instanceof IMethodBinding) { final IMethodBinding extended= (IMethodBinding) superBinding; if (fEnclosingMethod != null && fEnclosingMethod.overrides(extended)) return true; final ITypeBinding declaringBinding= extended.getDeclaringClass(); if (declaringBinding != null) { final IType type= (IType) declaringBinding.getJavaElement(); if (!fSuperReferenceType.equals(type)) return true; } } final AST ast= node.getAST(); final ThisExpression expression= ast.newThisExpression(); final MethodInvocation invocation= ast.newMethodInvocation(); final SimpleName simple= ast.newSimpleName(node.getName().getIdentifier()); invocation.setName(simple); invocation.setExpression(expression); final List<Expression> arguments= node.arguments(); if (arguments != null && arguments.size() > 0) { final ListRewrite rewriter= fRewrite.getListRewrite(invocation, MethodInvocation.ARGUMENTS_PROPERTY); ListRewrite superRewriter= fRewrite.getListRewrite(node, SuperMethodInvocation.ARGUMENTS_PROPERTY); ASTNode copyTarget= superRewriter.createCopyTarget(arguments.get(0), arguments.get(arguments.size() - 1)); rewriter.insertLast(copyTarget, null); } fRewrite.replace(node, invocation, null); if (!fSourceRewriter.getCu().equals(fTargetRewriter.getCu())) fSourceRewriter.getImportRemover().registerRemovedNode(node); return true; } return false; }
Example #21
Source File: ThrownExceptionVisitor.java From JDeodorant with MIT License | 5 votes |
public boolean visit(SuperMethodInvocation node) { IMethodBinding methodBinding = node.resolveMethodBinding(); for(ITypeBinding exceptionType : methodBinding.getExceptionTypes()) { typeBindings.add(exceptionType); } return super.visit(node); }
Example #22
Source File: CodeBlock.java From SimFix with GNU General Public License v2.0 | 5 votes |
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 #23
Source File: AdvancedQuickAssistProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static Expression getBooleanExpression(ASTNode node) { if (!(node instanceof Expression)) { return null; } // check if the node is a location where it can be negated StructuralPropertyDescriptor locationInParent= node.getLocationInParent(); if (locationInParent == QualifiedName.NAME_PROPERTY) { node= node.getParent(); locationInParent= node.getLocationInParent(); } while (locationInParent == ParenthesizedExpression.EXPRESSION_PROPERTY) { node= node.getParent(); locationInParent= node.getLocationInParent(); } Expression expression= (Expression) node; if (!isBoolean(expression)) { return null; } if (expression.getParent() instanceof InfixExpression) { return expression; } if (locationInParent == Assignment.RIGHT_HAND_SIDE_PROPERTY || locationInParent == IfStatement.EXPRESSION_PROPERTY || locationInParent == WhileStatement.EXPRESSION_PROPERTY || locationInParent == DoStatement.EXPRESSION_PROPERTY || locationInParent == ReturnStatement.EXPRESSION_PROPERTY || locationInParent == ForStatement.EXPRESSION_PROPERTY || locationInParent == AssertStatement.EXPRESSION_PROPERTY || locationInParent == MethodInvocation.ARGUMENTS_PROPERTY || locationInParent == ConstructorInvocation.ARGUMENTS_PROPERTY || locationInParent == SuperMethodInvocation.ARGUMENTS_PROPERTY || locationInParent == EnumConstantDeclaration.ARGUMENTS_PROPERTY || locationInParent == SuperConstructorInvocation.ARGUMENTS_PROPERTY || locationInParent == ClassInstanceCreation.ARGUMENTS_PROPERTY || locationInParent == ConditionalExpression.EXPRESSION_PROPERTY || locationInParent == PrefixExpression.OPERAND_PROPERTY) { return expression; } return null; }
Example #24
Source File: SourceAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean visit(SuperMethodInvocation node) { if (fTypeCounter == 0) { fHasSuperMethodInvocation= true; } return true; }
Example #25
Source File: CalleeAnalyzerVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Find all method invocations from the called method. Since we only traverse into * the AST on the wanted method declaration, this method should not hit on more * method invocations than those in the wanted method. * @param node node to visit * @return whether children should be visited * * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MethodInvocation) */ @Override public boolean visit(SuperMethodInvocation node) { progressMonitorWorked(1); if (!isFurtherTraversalNecessary(node)) { return false; } if (isNodeWithinMethod(node)) { addMethodCall(node.resolveMethodBinding(), node); } return true; }
Example #26
Source File: FullConstraintCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public ITypeConstraint[] create(SuperMethodInvocation invocation){ List<Expression> arguments= invocation.arguments(); List<ITypeConstraint> result= new ArrayList<ITypeConstraint>(arguments.size()); IMethodBinding methodBinding= invocation.resolveMethodBinding(); ITypeConstraint[] returnTypeConstraint= getReturnTypeConstraint(invocation, methodBinding); result.addAll(Arrays.asList(returnTypeConstraint)); result.addAll(Arrays.asList(getArgumentConstraints(arguments, methodBinding))); return result.toArray(new ITypeConstraint[result.size()]); }
Example #27
Source File: BindingSignatureVisitor.java From JDeodorant with MIT License | 5 votes |
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; }
Example #28
Source File: TargetProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean visit(SuperMethodInvocation node) { if (matches(node.getName().resolveBinding()) && fCurrent != null) { fCurrent.addInvocation(node); } return true; }
Example #29
Source File: LambdaExpressionsFix.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@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 #30
Source File: NewMethodCorrectionProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private ASTNode getInvocationNameNode() { ASTNode node= getInvocationNode(); if (node instanceof MethodInvocation) { return ((MethodInvocation)node).getName(); } else if (node instanceof SuperMethodInvocation) { return ((SuperMethodInvocation)node).getName(); } else if (node instanceof ClassInstanceCreation) { Type type= ((ClassInstanceCreation)node).getType(); while (type instanceof ParameterizedType) { type= ((ParameterizedType) type).getType(); } return type; } return null; }