Type newReturnType= ASTResolving.getTypeFromTypeBinding(astRoot.getAST(), binding);
String label= CorrectionMessages.getFormattedString("ReturnTypeSubProcessor.voidmethodreturns.description", binding.getName()); Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 2, image); String returnTypeName= proposal.addImport(binding);  Type newReturnType= ASTNodeFactory.newType(astRoot.getAST(), returnTypeName);
	public static void addVoidMethodReturnsProposals(ICorrectionContext context, List proposals) throws CoreException {		ICompilationUnit cu= context.getCompilationUnit();				CompilationUnit astRoot= context.getASTRoot();		ASTNode selectedNode= context.getCoveringNode();		if (selectedNode == null) {			return;		}					BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode);		if (decl instanceof MethodDeclaration && selectedNode.getNodeType() == ASTNode.RETURN_STATEMENT) {			ReturnStatement returnStatement= (ReturnStatement) selectedNode;			Expression expr= returnStatement.getExpression();			if (expr != null) {				ITypeBinding binding= ASTResolving.normalizeTypeBinding(expr.resolveTypeBinding());				if (binding == null) {					binding= selectedNode.getAST().resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$				}				MethodDeclaration methodDeclaration= (MethodDeclaration) decl;   								ASTRewrite rewrite= new ASTRewrite(methodDeclaration);				Type newReturnType= ASTResolving.getTypeFromTypeBinding(astRoot.getAST(), binding);								if (methodDeclaration.isConstructor()) {					MethodDeclaration modifiedNode= astRoot.getAST().newMethodDeclaration();					modifiedNode.setModifiers(methodDeclaration.getModifiers()); // no changes					modifiedNode.setExtraDimensions(methodDeclaration.getExtraDimensions()); // no changes					modifiedNode.setConstructor(false);					rewrite.markAsModified(methodDeclaration, modifiedNode);					methodDeclaration.setReturnType(newReturnType);					rewrite.markAsInserted(newReturnType);				} else {					rewrite.markAsReplaced(methodDeclaration.getReturnType(), newReturnType);				}												String label= CorrectionMessages.getFormattedString("ReturnTypeSubProcessor.voidmethodreturns.description", binding.getName()); //$NON-NLS-1$					Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);				ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 2, image);				proposal.addImport(binding);				proposal.ensureNoModifications();				proposals.add(proposal);			}			ASTRewrite rewrite= new ASTRewrite(decl);			rewrite.markAsRemoved(returnStatement);						String label= CorrectionMessages.getString("ReturnTypeSubProcessor.removereturn.description"); //$NON-NLS-1$				Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);			ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 1, image);			proposal.ensureNoModifications();			proposals.add(proposal);					}	}