当前位置: 首页>>代码示例>>Java>>正文


Java ClassInstanceCreation.arguments方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.ClassInstanceCreation.arguments方法的典型用法代码示例。如果您正苦于以下问题:Java ClassInstanceCreation.arguments方法的具体用法?Java ClassInstanceCreation.arguments怎么用?Java ClassInstanceCreation.arguments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.dom.ClassInstanceCreation的用法示例。


在下文中一共展示了ClassInstanceCreation.arguments方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: endVisit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public void endVisit(ClassInstanceCreation node) {
  Expression receiver = node.getExpression();
  Type createdType = node.getType();

  ConstraintVariable2 typeCv;
  if (node.getAnonymousClassDeclaration() == null) {
    typeCv = getConstraintVariable(createdType);
  } else {
    typeCv = fTCModel.makeImmutableTypeVariable(createdType.resolveBinding(), null);
    setConstraintVariable(createdType, typeCv);
  }
  setConstraintVariable(node, typeCv);

  IMethodBinding methodBinding = node.resolveConstructorBinding();
  Map<String, IndependentTypeVariable2> methodTypeVariables =
      createMethodTypeArguments(methodBinding);
  List<Expression> arguments = node.arguments();
  doVisitMethodInvocationArguments(
      methodBinding, arguments, receiver, methodTypeVariables, createdType);
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:InferTypeArgumentsConstraintCreator.java

示例2: create

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public ITypeConstraint[] create(ClassInstanceCreation instanceCreation) {
  List<Expression> arguments = instanceCreation.arguments();
  List<ITypeConstraint> result = new ArrayList<ITypeConstraint>(arguments.size());
  IMethodBinding methodBinding = instanceCreation.resolveConstructorBinding();
  result.addAll(Arrays.asList(getArgumentConstraints(arguments, methodBinding)));
  if (instanceCreation.getAnonymousClassDeclaration() == null) {
    ConstraintVariable constructorVar =
        fConstraintVariableFactory.makeExpressionOrTypeVariable(instanceCreation, getContext());
    ConstraintVariable typeVar =
        fConstraintVariableFactory.makeRawBindingVariable(instanceCreation.resolveTypeBinding());
    result.addAll(
        Arrays.asList(fTypeConstraintFactory.createDefinesConstraint(constructorVar, typeVar)));
  }
  return result.toArray(new ITypeConstraint[result.size()]);
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:FullConstraintCreator.java

示例3: endVisit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void endVisit(ClassInstanceCreation instanceCreation) {
	if (instanceCreation.getParent() instanceof ThrowStatement) {
		logger.warn("Ignoring throw statements!");
		return;
	}
	List<?> paramTypes = Arrays.asList(instanceCreation.resolveConstructorBinding().getParameterTypes());
	List<?> paramValues = instanceCreation.arguments();
	Constructor<?> constructor = retrieveConstructor(instanceCreation.getType(),
	                                                 paramTypes, paramValues);
	List<VariableReference> params = convertParams(instanceCreation.arguments(),
	                                               paramTypes);
	VariableReference retVal = retrieveVariableReference(instanceCreation, null);
	retVal.setOriginalCode(instanceCreation.toString());
	ConstructorStatement statement = new ValidConstructorStatement(
	        testCase.getReference(), constructor, retVal, params);
	testCase.addStatement(statement);
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:20,代码来源:TestExtractingVisitor.java

示例4: endVisit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public void endVisit(ClassInstanceCreation node) {
	Expression receiver= node.getExpression();
	Type createdType= node.getType();

	ConstraintVariable2 typeCv;
	if (node.getAnonymousClassDeclaration() == null) {
		typeCv= getConstraintVariable(createdType);
	} else {
		typeCv= fTCModel.makeImmutableTypeVariable(createdType.resolveBinding(), null);
		setConstraintVariable(createdType, typeCv);
	}
	setConstraintVariable(node, typeCv);

	IMethodBinding methodBinding= node.resolveConstructorBinding();
	Map<String, IndependentTypeVariable2> methodTypeVariables= createMethodTypeArguments(methodBinding);
	List<Expression> arguments= node.arguments();
	doVisitMethodInvocationArguments(methodBinding, arguments, receiver, methodTypeVariables, createdType);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:InferTypeArgumentsConstraintCreator.java

示例5: createValueOfInvocation

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
protected MethodInvocation createValueOfInvocation(ASTRewrite rewrite, CompilationUnit compilationUnit,
        ClassInstanceCreation primitiveTypeCreation) {
    Assert.isNotNull(rewrite);
    Assert.isNotNull(primitiveTypeCreation);

    final AST ast = rewrite.getAST();
    MethodInvocation valueOfInvocation = ast.newMethodInvocation();
    valueOfInvocation.setName(ast.newSimpleName(VALUE_OF_METHOD_NAME));

    ITypeBinding binding = primitiveTypeCreation.getType().resolveBinding();
    if (isStaticImport()) {
        addStaticImports(rewrite, compilationUnit, binding.getQualifiedName() + "." + VALUE_OF_METHOD_NAME);
    } else {
        valueOfInvocation.setExpression(ast.newSimpleName(binding.getName()));
    }

    List<?> arguments = primitiveTypeCreation.arguments();
    List<Expression> newArguments = valueOfInvocation.arguments();
    for (Object argument : arguments) {
        Expression expression = (Expression) rewrite.createCopyTarget((ASTNode) argument);
        newArguments.add(expression);
    }

    return valueOfInvocation;
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:26,代码来源:UseValueOfResolution.java

示例6: visit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public boolean visit(ClassInstanceCreation node) {
    if (badBigDecimalConstructor != null) {
        return false;
    }
    Type type = node.getType();
    if (type instanceof SimpleType
            && "BigDecimal".equals(((SimpleType) type).getName().getFullyQualifiedName())) {

        @SuppressWarnings("unchecked")
        List<Expression> args = node.arguments();
        if (args.size() == 1 && args.get(0) instanceof NumberLiteral) {
            badBigDecimalConstructor = node;
            this.decimalVar = (NumberLiteral) node.arguments().get(0);
        }
    }

    return true;
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:20,代码来源:BigDecimalConstructorResolution.java

示例7: visit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean visit(ClassInstanceCreation node) {
    if (foundThingToReplace()) {
        return false;
    }
    QMethodAndArgs key = QMethodAndArgs.make(node);

    if (csiConstructors.containsKey(key)) {
        List<Expression> arguments = node.arguments();
        Integer indexVal = (Integer) csiConstructors.get(key);
        int indexOfArgumentToReplace = (arguments.size() - indexVal) - 1;

        // if this was a constant string, resolveConstantExpressionValue() will be nonnull
        Object literalString = arguments.get(indexOfArgumentToReplace).resolveConstantExpressionValue();
        if (null != literalString) {
            this.literalValue = literalString.toString();
            this.badConstructorInvocation = node;
            fixedAstNode = makeFixedConstructorInvocation(node, indexOfArgumentToReplace);
            return false; // don't keep parsing
        }
    }
    return true;
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:25,代码来源:CharsetIssuesResolution.java

示例8: createFactoryMethodConstructorArgs

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
/**
 * Create the list of actual arguments to the constructor call that is encapsulated inside the
 * factory method, and associate the arguments with the given constructor call object.
 *
 * @param ast utility object used to create AST nodes
 * @param newCtorCall the newly-generated constructor call to be wrapped inside the factory method
 */
private void createFactoryMethodConstructorArgs(AST ast, ClassInstanceCreation newCtorCall) {
  List<Expression> argList = newCtorCall.arguments();

  for (int i = 0; i < fArgTypes.length; i++) {
    ASTNode ctorArg = ast.newSimpleName(fFormalArgNames[i]);

    argList.add((Expression) ctorArg);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:IntroduceFactoryRefactoring.java

示例9: createDefaultExpression

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
public Expression createDefaultExpression(List<Expression> invocationArguments, ParameterInfo addedInfo, List<ParameterInfo> parameterInfos, MethodDeclaration enclosingMethod, boolean isRecursive, CompilationUnitRewrite cuRewrite) {
	final AST ast= cuRewrite.getAST();
	final ASTRewrite rewrite= cuRewrite.getASTRewrite();
	if (isRecursive && canReuseParameterObject(invocationArguments, addedInfo, parameterInfos, enclosingMethod)) {
		return ast.newSimpleName(addedInfo.getNewName());
	}
	ClassInstanceCreation classCreation= ast.newClassInstanceCreation();

	int startPosition= enclosingMethod != null ? enclosingMethod.getStartPosition() : cuRewrite.getRoot().getStartPosition();
	ContextSensitiveImportRewriteContext context= fParameterObjectFactory.createParameterClassAwareContext(fCreateAsTopLevel, cuRewrite, startPosition);
	classCreation.setType(fParameterObjectFactory.createType(fCreateAsTopLevel, cuRewrite, startPosition));
	List<Expression> constructorArguments= classCreation.arguments();
	for (Iterator<ParameterInfo> iter= parameterInfos.iterator(); iter.hasNext();) {
		ParameterInfo pi= iter.next();
		if (isValidField(pi)) {
			if (pi.isOldVarargs()) {
				boolean isLastParameter= !iter.hasNext();
				constructorArguments.addAll(computeVarargs(invocationArguments, pi, isLastParameter, cuRewrite, context));
			} else {
				Expression exp= invocationArguments.get(pi.getOldIndex());
				importNodeTypes(exp, cuRewrite, context);
				constructorArguments.add(moveNode(exp, rewrite));
			}
		}
	}
	return classCreation;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:IntroduceParameterObjectProcessor.java

示例10: createFactoryMethodConstructorArgs

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
/**
 * Create the list of actual arguments to the constructor call that is
 * encapsulated inside the factory method, and associate the arguments
 * with the given constructor call object.
 * @param ast utility object used to create AST nodes
 * @param newCtorCall the newly-generated constructor call to be wrapped inside
 * the factory method
 */
private void createFactoryMethodConstructorArgs(AST ast, ClassInstanceCreation newCtorCall) {
	List<Expression> argList= newCtorCall.arguments();

	for(int i=0; i < fArgTypes.length; i++) {
		ASTNode ctorArg= ast.newSimpleName(fFormalArgNames[i]);

		argList.add((Expression) ctorArg);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:IntroduceFactoryRefactoring.java

示例11: create

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public ITypeConstraint[] create(ClassInstanceCreation instanceCreation){
	List<Expression> arguments= instanceCreation.arguments();
	List<ITypeConstraint> result= new ArrayList<ITypeConstraint>(arguments.size());
	IMethodBinding methodBinding= instanceCreation.resolveConstructorBinding();
	result.addAll(Arrays.asList(getArgumentConstraints(arguments, methodBinding)));
	if (instanceCreation.getAnonymousClassDeclaration() == null){
		ConstraintVariable constructorVar= fConstraintVariableFactory.makeExpressionOrTypeVariable(instanceCreation, getContext());
		ConstraintVariable typeVar= fConstraintVariableFactory.makeRawBindingVariable(instanceCreation.resolveTypeBinding());
		result.addAll(Arrays.asList(fTypeConstraintFactory.createDefinesConstraint(constructorVar, typeVar)));
	}
	return result.toArray(new ITypeConstraint[result.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:FullConstraintCreator.java

示例12: JavaAssignment

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
/**
 * Constructor for this class if on the right hand side is a constructor call.
 * @param parent The parent of this artifact.
 * @param expression The Statement expression, which may be edited.
 * @param attributeName then name of the attribute as string
 * @param typeBinding The type of the LHS (qualified name),
 *     i.e. to which <b>TYPE</b> it is assigned <b>TO</b>.
 * @param rhs The creation of the assignment of the right hand side (a constructor call).
 */
JavaAssignment(IJavaParent parent, ExpressionStatement expression, String attributeName, ITypeBinding typeBinding, 
    ClassInstanceCreation rhs) {
    super(parent, expression, attributeName, typeBinding);
    if (null != rhs) {
        ITypeBinding rhsBinding = rhs.resolveTypeBinding();
        arguments = rhs.arguments();
        if (null != rhsBinding) {
            this.fromType = (null != rhs && null != rhsBinding) ? rhsBinding.getQualifiedName() : null;
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:21,代码来源:JavaAssignment.java

示例13: write

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public void write(ASTNode node) {
	ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) node;

	//TODO: Handle type arguments
	//TODO: Handle different reference operator used for stack objects

	// TODO: Support inner class creation via object.new
	if (classInstanceCreation.getExpression() != null)
		throw sourceNotSupported("Inner classes not yet supported");

	matchAndWrite("new");
	copySpaceAndComments();

       swiftASTWriters.writeNode(classInstanceCreation.getType());
	copySpaceAndComments();

	matchAndWrite("(");
	copySpaceAndComments();

	List<?> arguments = classInstanceCreation.arguments();

	boolean first = true;
	for (Object object : arguments) {
		Expression argument = (Expression) object;

		if (! first) {
			matchAndWrite(",");
			copySpaceAndComments();
		}

           swiftASTWriters.writeNode(argument);
		copySpaceAndComments();

		first = false;
	}

	matchAndWrite(")");
}
 
开发者ID:juniversal,项目名称:juniversal,代码行数:40,代码来源:ClassInstanceCreationWriter.java

示例14: write

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public void write(ClassInstanceCreation classInstanceCreation) {
	//TODO: Handle type arguments
	//TODO: Handle different reference operator used for stack objects

	// TODO: Support inner class creation via object.new
	if (classInstanceCreation.getExpression() != null)
		throw sourceNotSupported("Inner classes not yet supported");

	matchAndWrite("new");
	copySpaceAndComments();

       writeNode(classInstanceCreation.getType());
	copySpaceAndComments();

	matchAndWrite("(");
	copySpaceAndComments();

	List<?> arguments = classInstanceCreation.arguments();

	boolean first = true;
	for (Object object : arguments) {
		Expression argument = (Expression) object;

		if (! first) {
			matchAndWrite(",");
			copySpaceAndComments();
		}

           writeNode(argument);
		copySpaceAndComments();

		first = false;
	}

	matchAndWrite(")");
}
 
开发者ID:juniversal,项目名称:juniversal,代码行数:38,代码来源:ClassInstanceCreationWriter.java

示例15: makeFixedConstructorInvocation

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private ASTNode makeFixedConstructorInvocation(ClassInstanceCreation node, int indexOfArgumentToReplace) {
    if (rootAstNode == null || rewrite == null) {
        return null;
    }
    ClassInstanceCreation newNode = rootAstNode.newClassInstanceCreation();
    newNode.setType((org.eclipse.jdt.core.dom.Type) rewrite.createCopyTarget(node.getType()));

    List<Expression> newArgs = newNode.arguments();
    List<Expression> oldArgs = node.arguments();

    copyArgsAndReplaceWithCharset(oldArgs, newArgs, indexOfArgumentToReplace);
    return newNode;
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:15,代码来源:CharsetIssuesResolution.java


注:本文中的org.eclipse.jdt.core.dom.ClassInstanceCreation.arguments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。