View | Details | Raw Unified | Return to bug 287123 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/jdt/internal/ui/text/correction/QuickAssistProcessor.java (-2 / +4 lines)
Lines 474-480 Link Here
474
		}
474
		}
475
475
476
		IVariableBinding binding= fragment.resolveBinding();
476
		IVariableBinding binding= fragment.resolveBinding();
477
		if (fragment.getInitializer() != null || binding == null || binding.isField()) {
477
		Expression initializer= fragment.getInitializer();
478
		if ((initializer != null && initializer.getNodeType() != ASTNode.NULL_LITERAL) || binding == null || binding.isField()) {
478
			return false;
479
			return false;
479
		}
480
		}
480
481
Lines 548-554 Link Here
548
			return false;
549
			return false;
549
		}
550
		}
550
551
551
		if (fragment.getInitializer() == null) {
552
		Expression initializer= fragment.getInitializer();
553
		if (initializer == null || initializer.getNodeType() == ASTNode.NULL_LITERAL) {
552
			return false;
554
			return false;
553
		}
555
		}
554
556
(-)ui/org/eclipse/jdt/ui/tests/quickfix/AssistQuickFixTest.java (-11 / +33 lines)
Lines 1834-1851 Link Here
1834
		AssistContext context= getCorrectionContext(cu, buf.toString().indexOf(str), 0);
1834
		AssistContext context= getCorrectionContext(cu, buf.toString().indexOf(str), 0);
1835
		List proposals= collectAssists(context, false);
1835
		List proposals= collectAssists(context, false);
1836
1836
1837
		assertNumberOfProposals(proposals, 2);
1837
		assertNumberOfProposals(proposals, 1);
1838
		assertCorrectLabels(proposals);
1838
		assertCorrectLabels(proposals);
1839
1840
		buf= new StringBuffer();
1841
		buf.append("package test1;\n");
1842
		buf.append("public class E {\n");
1843
		buf.append("    public void foo() {\n");
1844
		buf.append("        final int i[];\n");
1845
		buf.append("        i = null;\n");
1846
		buf.append("    }\n");
1847
		buf.append("}\n");
1848
		assertExpectedExistInProposals(proposals, new String[] { buf.toString() });
1849
	}
1839
	}
1850
1840
1851
	public void testSplitDeclaration4() throws Exception {
1841
	public void testSplitDeclaration4() throws Exception {
Lines 2041-2046 Link Here
2041
		assertExpectedExistInProposals(proposals, new String[] {expected1});
2031
		assertExpectedExistInProposals(proposals, new String[] {expected1});
2042
	}
2032
	}
2043
2033
2034
	public void testJoinDeclaration3() throws Exception {
2035
		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
2036
		StringBuffer buf= new StringBuffer();
2037
		buf.append("package test1;\n");
2038
		buf.append("public class E {\n");
2039
		buf.append("    public void foo() {\n");
2040
		buf.append("        int var[] = null;\n");
2041
		buf.append("        foo();\n");
2042
		buf.append("        var = new int[10];\n");
2043
		buf.append("    }\n");
2044
		buf.append("}\n");
2045
		ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
2046
2047
		String str= "var[]";
2048
		AssistContext context= getCorrectionContext(cu, buf.toString().indexOf(str), 0);
2049
		List proposals= collectAssists(context, false);
2050
2051
		assertNumberOfProposals(proposals, 2);
2052
		assertCorrectLabels(proposals);
2053
2054
		buf= new StringBuffer();
2055
		buf.append("package test1;\n");
2056
		buf.append("public class E {\n");
2057
		buf.append("    public void foo() {\n");
2058
		buf.append("        int var[] = new int[10];\n");
2059
		buf.append("        foo();\n");
2060
		buf.append("    }\n");
2061
		buf.append("}\n");
2062
2063
		assertExpectedExistInProposals(proposals, new String[] { buf.toString() });
2064
	}
2065
2044
	private static final Class[] FILTER_EQ= { LinkedNamesAssistProposal.class, RenameRefactoringProposal.class, AssignToVariableAssistProposal.class };
2066
	private static final Class[] FILTER_EQ= { LinkedNamesAssistProposal.class, RenameRefactoringProposal.class, AssignToVariableAssistProposal.class };
2045
2067
2046
    public void testInvertEquals() throws Exception {
2068
    public void testInvertEquals() throws Exception {

Return to bug 287123