Java Code Examples for org.eclipse.jdt.core.dom.ConstructorInvocation#arguments()
The following examples show how to use
org.eclipse.jdt.core.dom.ConstructorInvocation#arguments() .
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: CodeBlock.java From SimFix with GNU General Public License v2.0 | 5 votes |
private ConstructorInv visit(ConstructorInvocation node) { int startLine = _cunit.getLineNumber(node.getStartPosition()); int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength()); ConstructorInv constructorInv = new ConstructorInv(startLine, endLine, node); List<Expr> arguments = new ArrayList<>(); for(Object object : node.arguments()){ Expr expr = (Expr) process((ASTNode) object); expr.setParent(constructorInv); arguments.add(expr); } constructorInv.setArguments(arguments); return constructorInv; }
Example 2
Source File: OperationInvocation.java From RefactoringMiner with MIT License | 5 votes |
public OperationInvocation(CompilationUnit cu, String filePath, ConstructorInvocation invocation) { this.locationInfo = new LocationInfo(cu, filePath, invocation, CodeElementType.CONSTRUCTOR_INVOCATION); this.methodName = "this"; this.typeArguments = invocation.arguments().size(); this.arguments = new ArrayList<String>(); List<Expression> args = invocation.arguments(); for(Expression argument : args) { this.arguments.add(argument.toString()); } }
Example 3
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 4
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); } } } } }