Java Code Examples for org.eclipse.jdt.core.dom.ConstructorInvocation#resolveConstructorBinding()
The following examples show how to use
org.eclipse.jdt.core.dom.ConstructorInvocation#resolveConstructorBinding() .
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: SemanticHighlightingReconciler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public boolean visit(ConstructorInvocation node) { // XXX Hack for performance reasons (should loop over fJobSemanticHighlightings can call consumes(*)) if (fJobDeprecatedMemberHighlighting != null) { IMethodBinding constructorBinding= node.resolveConstructorBinding(); if (constructorBinding != null && constructorBinding.isDeprecated()) { int offset= node.getStartPosition(); int length= 4; if (offset > -1 && length > 0) { addPosition(offset, length, fJobDeprecatedMemberHighlighting); } } } return true; }
Example 2
Source File: FullConstraintCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public ITypeConstraint[] create(ConstructorInvocation invocation){ List<Expression> arguments= invocation.arguments(); List<ITypeConstraint> result= new ArrayList<ITypeConstraint>(arguments.size()); IMethodBinding methodBinding= invocation.resolveConstructorBinding(); result.addAll(Arrays.asList(getArgumentConstraints(arguments, methodBinding))); return result.toArray(new ITypeConstraint[result.size()]); }
Example 3
Source File: VariableDeclarationFix.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private boolean callsWritingConstructor(MethodDeclaration methodDeclaration, HashSet<IMethodBinding> writingConstructorBindings, Set<MethodDeclaration> visitedMethodDeclarations) { Block body= methodDeclaration.getBody(); if (body == null) return false; List<Statement> statements= body.statements(); if (statements.size() == 0) return false; Statement statement= statements.get(0); if (!(statement instanceof ConstructorInvocation)) return false; ConstructorInvocation invocation= (ConstructorInvocation)statement; IMethodBinding constructorBinding= invocation.resolveConstructorBinding(); if (constructorBinding == null) return false; if (writingConstructorBindings.contains(constructorBinding)) { return true; } else { ASTNode declaration= ASTNodes.findDeclaration(constructorBinding, methodDeclaration.getParent()); if (!(declaration instanceof MethodDeclaration)) return false; if (visitedMethodDeclarations.contains(declaration)) { return false; } visitedMethodDeclarations.add(methodDeclaration); return callsWritingConstructor((MethodDeclaration)declaration, writingConstructorBindings, visitedMethodDeclarations); } }
Example 4
Source File: SemanticHighlightingReconciler.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean visit(ConstructorInvocation node) { // XXX Hack for performance reasons (should loop over fJobSemanticHighlightings can call consumes(*)) if (fJobDeprecatedMemberHighlighting != null) { IMethodBinding constructorBinding= node.resolveConstructorBinding(); if (constructorBinding != null && constructorBinding.isDeprecated()) { int offset= node.getStartPosition(); int length= 4; if (offset > -1 && length > 0) addPosition(offset, length, fJobDeprecatedMemberHighlighting); } } return true; }
Example 5
Source File: AbstractMethodFragment.java From JDeodorant with MIT License | 5 votes |
protected void processConstructorInvocation(ConstructorInvocation constructorInvocation) { IMethodBinding methodBinding = constructorInvocation.resolveConstructorBinding(); String originClassName = methodBinding.getDeclaringClass().getQualifiedName(); TypeObject originClassTypeObject = TypeObject.extractTypeObject(originClassName); String methodInvocationName = methodBinding.getName(); String qualifiedName = methodBinding.getReturnType().getQualifiedName(); TypeObject returnType = TypeObject.extractTypeObject(qualifiedName); ConstructorInvocationObject constructorInvocationObject = new ConstructorInvocationObject(originClassTypeObject, methodInvocationName, returnType); constructorInvocationObject.setConstructorInvocation(constructorInvocation); ITypeBinding[] parameterTypes = methodBinding.getParameterTypes(); for(ITypeBinding parameterType : parameterTypes) { String qualifiedParameterName = parameterType.getQualifiedName(); TypeObject typeObject = TypeObject.extractTypeObject(qualifiedParameterName); constructorInvocationObject.addParameter(typeObject); } ITypeBinding[] thrownExceptionTypes = methodBinding.getExceptionTypes(); for(ITypeBinding thrownExceptionType : thrownExceptionTypes) { constructorInvocationObject.addThrownException(thrownExceptionType.getQualifiedName()); } if((methodBinding.getModifiers() & Modifier.STATIC) != 0) constructorInvocationObject.setStatic(true); addConstructorInvocation(constructorInvocationObject); List<Expression> arguments = constructorInvocation.arguments(); for(Expression argument : arguments) { if(argument instanceof SimpleName) { SimpleName argumentName = (SimpleName)argument; IBinding binding = argumentName.resolveBinding(); if(binding != null && binding.getKind() == IBinding.VARIABLE) { IVariableBinding variableBinding = (IVariableBinding)binding; if(variableBinding.isParameter()) { PlainVariable variable = new PlainVariable(variableBinding); addParameterPassedAsArgumentInConstructorInvocation(variable, constructorInvocationObject); } } } } }
Example 6
Source File: SuperTypeConstraintsCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public final void endVisit(final ConstructorInvocation node) { final IMethodBinding binding= node.resolveConstructorBinding(); if (binding != null) endVisit(node.arguments(), binding); }