Bug 25098 Quickfix for The local variable may not have been initialized.. [quick fix]
Often I write code like this: String name; try { name = "Good value"; int val = name.indexOf(42); } catch(Exception e) { throw new RuntimeException("Something went wrong with " + name); } The declaration of name is placed outside the try clause to provide access to it inside the catch. Here eclipse (as it should) complains that "The local variable name may not have been initialized". How about providing a QuickFix that assigned null to the uninitialized variable (e.g. "String name = null")
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
buf.append("public class E {\n");
		buf.append("    public static void goo() {\n");
		buf.append("    }\n");				
		buf.append("    public void foo() {\n");
		buf.append("        E.goo();\n");
		buf.append("    }\n");
		buf.append("}\n");
		assertEqualString(preview, buf.toString());
	}
	
	public void testCastMissingInVarDecl() throws Exception {
		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
		StringBuffer buf= new StringBuffer();
		buf.append("package test1;\n");
		buf.append("public class E {\n");
		buf.append("    public void foo(Object o) {\n");
		buf.append("        Thread th= o;\n");
		buf.append("    }\n");
		buf.append("}\n");
		ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
		
		CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);
		IProblem[] problems= astRoot.getProblems();
		assertNumberOf("problems", problems.length, 1);
		
		CorrectionContext context= getCorrectionContext(cu, problems[0]);
		assertCorrectContext(context);
		ArrayList proposals= new ArrayList();
		
		JavaCorrectionProcessor.collectCorrections(context,  proposals);