proposal.addLinkedModeProposal(returnKey, typeSuggestions[i]);
proposal.addLinkedPositionProposal(returnKey, typeSuggestions[i]);
	public static void addCastProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException {		String[] args= problem.getProblemArguments();		if (args.length != 2) {			return;		}					ICompilationUnit cu= context.getCompilationUnit();		String castType= args[1];		CompilationUnit astRoot= context.getASTRoot();		ASTNode selectedNode= problem.getCoveredNode(astRoot);		if (!(selectedNode instanceof Expression)) {			return;		}		Expression nodeToCast= (Expression) selectedNode;				int parentNodeType= selectedNode.getParent().getNodeType();		if (parentNodeType == ASTNode.ASSIGNMENT) {			Assignment assign= (Assignment) selectedNode.getParent();			if (selectedNode.equals(assign.getLeftHandSide())) {				nodeToCast= assign.getRightHandSide();			}		} else if (parentNodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) {			VariableDeclarationFragment frag= (VariableDeclarationFragment) selectedNode.getParent();			if (selectedNode.equals(frag.getName())) {				nodeToCast= frag.getInitializer();			}		}		ITypeBinding binding= nodeToCast.resolveTypeBinding();		if (binding == null || canCast(castType, binding)) {			proposals.add(createCastProposal(context, castType, nodeToCast, 5));		}				ITypeBinding currBinding= nodeToCast.resolveTypeBinding();				if (currBinding == null || "void".equals(currBinding.getName())) { //$NON-NLS-1$			return;		}				// change method return statement to actual type		if (parentNodeType == ASTNode.RETURN_STATEMENT) {			BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode);			if (decl instanceof MethodDeclaration) {				MethodDeclaration methodDeclaration= (MethodDeclaration) decl;					currBinding= Bindings.normalizeTypeBinding(currBinding);				if (currBinding == null) {					currBinding= astRoot.getAST().resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$				}					ASTRewrite rewrite= new ASTRewrite(methodDeclaration.getAST());				ImportRewrite imports= new ImportRewrite(cu);				String returnTypeName= imports.addImport(currBinding);								Type newReturnType= ASTNodeFactory.newType(astRoot.getAST(), returnTypeName);				rewrite.replace(methodDeclaration.getReturnType(), newReturnType, null);								String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changereturntype.description", currBinding.getName()); //$NON-NLS-1$				Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);				LinkedCorrectionProposal proposal= new LinkedCorrectionProposal(label, cu, rewrite, 6, image);				proposal.setImportRewrite(imports);								String returnKey= "return"; //$NON-NLS-1$				proposal.markAsLinked(rewrite, newReturnType, true, returnKey);				ITypeBinding[] typeSuggestions= ASTResolving.getRelaxingTypes(astRoot.getAST(), currBinding);				for (int i= 0; i < typeSuggestions.length; i++) {					proposal.addLinkedModeProposal(returnKey, typeSuggestions[i]);				}				proposals.add(proposal);			}		}		if (parentNodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) {			VariableDeclarationFragment fragment= (VariableDeclarationFragment) selectedNode.getParent();			ASTNode parent= fragment.getParent();			Type typeNode= null;						if (parent instanceof VariableDeclarationStatement) {				VariableDeclarationStatement stmt= (VariableDeclarationStatement) parent;				if (stmt.fragments().size() == 1) {					typeNode= stmt.getType();				}			} else if (parent instanceof FieldDeclaration) {				FieldDeclaration decl= (FieldDeclaration) parent;				if (decl.fragments().size() == 1) {					typeNode= decl.getType();				}			}						if (typeNode != null) {				currBinding= Bindings.normalizeTypeBinding(currBinding);				if (currBinding == null) {					currBinding= astRoot.getAST().resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$				}											ImportRewrite importRewrite= new ImportRewrite(cu);				String typeName= importRewrite.addImport(currBinding);					String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changevartype.description", typeName); //$NON-NLS-1$				ReplaceCorrectionProposal varProposal= new ReplaceCorrectionProposal(label, cu, typeNode.getStartPosition(), typeNode.getLength(), typeName, 5);				varProposal.setImportRewrite(importRewrite);								proposals.add(varProposal);			}		}				}	