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

Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (+3 lines)
Lines 3630-3635 Link Here
3630
			addExpectedType(TypeBinding.BOOLEAN, scope);
3630
			addExpectedType(TypeBinding.BOOLEAN, scope);
3631
		} else if (parent instanceof IfStatement) {  
3631
		} else if (parent instanceof IfStatement) {  
3632
			addExpectedType(TypeBinding.BOOLEAN, scope);
3632
			addExpectedType(TypeBinding.BOOLEAN, scope);
3633
		}
3634
		else if (parent instanceof AssertStatement) {
3635
			addExpectedType(TypeBinding.BOOLEAN, scope);
3633
		} else if (parent instanceof ForStatement) {   // astNodeParent set to ForStatement only for the condition  
3636
		} else if (parent instanceof ForStatement) {   // astNodeParent set to ForStatement only for the condition  
3634
			addExpectedType(TypeBinding.BOOLEAN, scope);
3637
			addExpectedType(TypeBinding.BOOLEAN, scope);
3635
3638
(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (+28 lines)
Lines 20101-20105 Link Here
20101
			"methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test253008;, ()Z, methodReturningBoolean, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
20101
			"methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test253008;, ()Z, methodReturningBoolean, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
20102
			requestor.getResults());
20102
			requestor.getResults());
20103
}
20103
}
20104
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=274466
20105
// Check for boolean methods with higher relevance in assert statements
20106
public void test274466() throws JavaModelException {
20107
	this.workingCopies = new ICompilationUnit[1];
20108
	this.workingCopies[0] = getWorkingCopy(
20109
			"/Completion/src/test/Test274466.java",
20110
			"package test;" +
20111
			"public class Test274466 {\n" +
20112
			"	boolean methodReturningBoolean() { return true; }\n" +
20113
			"   void methodReturningBlah() { return; }\n" +
20114
			"	int foo(int p) {\n" +
20115
			"     assert methodR" +
20116
			"	}\n" +
20117
			"}\n");
20118
			
20119
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
20120
	String str = this.workingCopies[0].getSource();
20121
	String completeBehind = "methodR";
20122
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
20123
20124
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
20125
	assertResults(
20126
			"methodReturningBlah[METHOD_REF]{methodReturningBlah(), Ltest.Test274466;, ()V, methodReturningBlah, " + 
20127
					(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
20128
			"methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test274466;, ()Z, methodReturningBoolean, " + 
20129
					(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}",
20130
			requestor.getResults());	
20131
}
20104
20132
20105
}
20133
}

Return to bug 274466