ITypeBinding arrayType= creation.resolveTypeBinding(); if (arrayType != null && arrayType.isAssignmentCompatible(varArgPI.getNewTypeBinding())) { constructorArguments.add(moveNode(creation, rewrite)); return constructorArguments; Expression node= invocationArguments.get(i); importNodeTypes(node, cuRewrite, context); constructorArguments.add(moveNode(node, rewrite)); constructorArguments.add(moveNode(nullLiteral, rewrite)); } else { ArrayCreation creation= ast.newArrayCreation(); Expression node= invocationArguments.get(i); importNodeTypes(node, cuRewrite, context); expressions.add(moveNode(node, rewrite));
ITypeBinding arrayType= creation.resolveTypeBinding(); if (arrayType != null && arrayType.isAssignmentCompatible(varArgPI.getNewTypeBinding())) { constructorArguments.add(moveNode(creation, rewrite)); return constructorArguments; Expression node= invocationArguments.get(i); importNodeTypes(node, cuRewrite, context); constructorArguments.add(moveNode(node, rewrite)); constructorArguments.add(moveNode(nullLiteral, rewrite)); } else { ArrayCreation creation= ast.newArrayCreation(); Expression node= invocationArguments.get(i); importNodeTypes(node, cuRewrite, context); expressions.add(moveNode(node, rewrite));
@Override 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; }
@Override 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; }