ITypeBinding typeBinding= eval.getTypeBinding();  ASTRewrite rewrite= new ASTRewrite(astRoot); AST ast= astRoot.getAST();  Type type; String typeName; if (typeBinding != null) { type= ASTResolving.getTypeFromTypeBinding(ast, typeBinding); typeName= typeBinding.getName(); } else { type= ast.newPrimitiveType(PrimitiveType.VOID); typeName= "void"; }  String label= CorrectionMessages.getFormattedString("ReturnTypeSubProcessor.missingreturntype.description", typeName); Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 1, image); if (typeBinding != null) { proposal.addImport(typeBinding); }
ITypeBinding typeBinding= eval.getTypeBinding();  ASTRewrite rewrite= new ASTRewrite(astRoot); AST ast= astRoot.getAST();  Type type; String typeName; if (typeBinding != null) { type= ASTResolving.getTypeFromTypeBinding(ast, typeBinding); typeName= typeBinding.getName(); } else { type= ast.newPrimitiveType(PrimitiveType.VOID); typeName= "void"; }  String label= CorrectionMessages.getFormattedString("ReturnTypeSubProcessor.missingreturntype.description", typeName); Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 2, image); if (typeBinding != null) { proposal.addImport(typeBinding); } rewrite.markAsInserted(type); methodDeclaration.setReturnType(type);
	public static void addMissingReturnTypeProposals(ProblemPosition problemPos, ArrayList proposals) throws CoreException {		ICompilationUnit cu= problemPos.getCompilationUnit();				CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);		ASTNode selectedNode= ASTResolving.findSelectedNode(astRoot, problemPos.getOffset(), problemPos.getLength());		if (selectedNode != null) {			BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode);			if (decl instanceof MethodDeclaration) {				ReturnTypeEvaluator eval= new ReturnTypeEvaluator();				decl.accept(eval);				ITypeBinding typeBinding= eval.getTypeBinding();					ASTRewrite rewrite= new ASTRewrite(astRoot);				AST ast= astRoot.getAST();					Type type;				String typeName;				if (typeBinding != null) {					type= ASTResolving.getTypeFromTypeBinding(ast, typeBinding);					typeName= typeBinding.getName();				} else {					type= ast.newPrimitiveType(PrimitiveType.VOID);					typeName= "void";				}						String label= CorrectionMessages.getFormattedString("ReturnTypeSubProcessor.missingreturntype.description", typeName); //$NON-NLS-1$						Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);				ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 1, image);				if (typeBinding != null) {					proposal.addImport(typeBinding);				}							rewrite.markAsInserted(type);				((MethodDeclaration) decl).setReturnType(type);					proposals.add(proposal);			}		}	}