boolean canSwap= TypeRules.canAssign(argTypes[idx1], paramTypes[idx2]) && TypeRules.canAssign(argTypes[idx2], paramTypes[idx1]);
boolean canSwap= canAssign(argTypes[idx1], paramTypes[idx2]) && canAssign(argTypes[idx2], paramTypes[idx1]);
	private static void doEqualNumberOfParameters(IInvocationContext context, ASTNode invocationNode, IProblemLocation problem, List arguments, ITypeBinding[] argTypes, IMethodBinding methodBinding, Collection proposals) throws CoreException {		ITypeBinding[] paramTypes= methodBinding.getParameterTypes();		int[] indexOfDiff= new int[paramTypes.length];		int nDiffs= 0;		for (int n= 0; n < argTypes.length; n++) {			if (!TypeRules.canAssign(argTypes[n], paramTypes[n])) {				indexOfDiff[nDiffs++]= n;			}		}		ITypeBinding declaringTypeDecl= methodBinding.getDeclaringClass().getTypeDeclaration();		ICompilationUnit cu= context.getCompilationUnit();		CompilationUnit astRoot= context.getASTRoot();		ASTNode nameNode= problem.getCoveringNode(astRoot);		if (nameNode == null) {			return;		}		if (nDiffs == 0) {			if (nameNode.getParent() instanceof MethodInvocation) {				MethodInvocation inv= (MethodInvocation) nameNode.getParent();				if (inv.getExpression() == null) {					addQualifierToOuterProposal(context, inv, methodBinding, proposals);				}			}			return;		}		if (nDiffs == 1) { // one argument mismatching: try to fix			int idx= indexOfDiff[0];			Expression nodeToCast= (Expression) arguments.get(idx);			ITypeBinding castType= paramTypes[idx];			castType= Bindings.normalizeTypeBinding(castType);			if (castType.isWildcardType()) {				castType= ASTResolving.normalizeWildcardType(castType, false, nodeToCast.getAST());			}			if (castType != null) {				ITypeBinding binding= nodeToCast.resolveTypeBinding();				if (binding == null || binding.isCastCompatible(castType)) {					String castTypeName= castType.getQualifiedName();					ASTRewriteCorrectionProposal proposal= TypeMismatchSubProcessor.createCastProposal(context, castTypeName, castType, nodeToCast, 6);					String[] arg= new String[] { getArgumentName(cu, arguments, idx), castTypeName};					proposal.setDisplayName(Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_addargumentcast_description, arg));					proposals.add(proposal);				}				TypeMismatchSubProcessor.addChangeSenderTypeProposals(context, nodeToCast, castType, false, 5, proposals);			}		}		if (nDiffs == 2) { // try to swap			int idx1= indexOfDiff[0];			int idx2= indexOfDiff[1];			boolean canSwap= TypeRules.canAssign(argTypes[idx1], paramTypes[idx2]) && TypeRules.canAssign(argTypes[idx2], paramTypes[idx1]);			 if (canSwap) {				Expression arg1= (Expression) arguments.get(idx1);				Expression arg2= (Expression) arguments.get(idx2);				ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());				rewrite.replace(arg1, rewrite.createCopyTarget(arg2), null);				rewrite.replace(arg2, rewrite.createCopyTarget(arg1), null);				{					String[] arg= new String[] { getArgumentName(cu, arguments, idx1), getArgumentName(cu, arguments, idx2) };					String label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_swaparguments_description, arg);					Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);					ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, 8, image);					proposals.add(proposal);				}				if (declaringTypeDecl.isFromSource()) {					ICompilationUnit targetCU= ASTResolving.findCompilationUnitForBinding(cu, astRoot, declaringTypeDecl);					if (targetCU != null) {						ChangeDescription[] changeDesc= new ChangeDescription[paramTypes.length];						for (int i= 0; i < nDiffs; i++) {							changeDesc[idx1]= new SwapDescription(idx2);						}						IMethodBinding methodDecl= methodBinding.getMethodDeclaration();						ITypeBinding[] declParamTypes= methodDecl.getParameterTypes();						ITypeBinding[] swappedTypes= new ITypeBinding[] { declParamTypes[idx1], declParamTypes[idx2] };						String[] args=  new String[] { ASTResolving.getMethodSignature(methodDecl, !targetCU.equals(cu)), getTypeNames(swappedTypes) };						String label;						if (methodDecl.isConstructor()) {							label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_swapparams_constr_description, args);						} else {							label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_swapparams_description, args);						}						Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);						ChangeMethodSignatureProposal proposal= new ChangeMethodSignatureProposal(label, targetCU, invocationNode, methodDecl, changeDesc, null, 5, image);						proposals.add(proposal);					}				}				return;			}		}		if (declaringTypeDecl.isFromSource()) {			ICompilationUnit targetCU= ASTResolving.findCompilationUnitForBinding(cu, astRoot, declaringTypeDecl);			if (targetCU != null) {				ChangeDescription[] changeDesc= createSignatureChangeDescription(indexOfDiff, nDiffs, paramTypes, arguments, argTypes);				if (changeDesc != null) {									IMethodBinding methodDecl= methodBinding.getMethodDeclaration();					ITypeBinding[] declParamTypes= methodDecl.getParameterTypes();						ITypeBinding[] newParamTypes= new ITypeBinding[changeDesc.length];					for (int i= 0; i < newParamTypes.length; i++) {						newParamTypes[i]= changeDesc[i] == null ? declParamTypes[i] : ((EditDescription) changeDesc[i]).type;					}						String[] args=  new String[] { ASTResolving.getMethodSignature(methodDecl, !targetCU.equals(cu)), ASTResolving.getMethodSignature(methodDecl.getName(), newParamTypes) };					String label;					if (methodDecl.isConstructor()) {						label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_changeparamsignature_constr_description, args);					} else {						label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_changeparamsignature_description, args);					}					Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);					ChangeMethodSignatureProposal proposal= new ChangeMethodSignatureProposal(label, targetCU, invocationNode, methodDecl, changeDesc, null, 7, image);					proposals.add(proposal);				}			}		}	}