### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v retrieving revision 1.395 diff -u -r1.395 CompletionEngine.java --- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 27 Apr 2009 09:38:22 -0000 1.395 +++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 11 May 2009 11:41:58 -0000 @@ -3630,6 +3630,9 @@ addExpectedType(TypeBinding.BOOLEAN, scope); } else if (parent instanceof IfStatement) { addExpectedType(TypeBinding.BOOLEAN, scope); + } + else if (parent instanceof AssertStatement) { + addExpectedType(TypeBinding.BOOLEAN, scope); } else if (parent instanceof ForStatement) { // astNodeParent set to ForStatement only for the condition addExpectedType(TypeBinding.BOOLEAN, scope); #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/CompletionTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java,v retrieving revision 1.203 diff -u -r1.203 CompletionTests.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 7 May 2009 08:49:30 -0000 1.203 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 11 May 2009 11:42:29 -0000 @@ -20101,5 +20101,33 @@ "methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test253008;, ()Z, methodReturningBoolean, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", requestor.getResults()); } +// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=274466 +// Check for boolean methods with higher relevance in assert statements +public void test274466() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/test/Test274466.java", + "package test;" + + "public class Test274466 {\n" + + " boolean methodReturningBoolean() { return true; }\n" + + " void methodReturningBlah() { return; }\n" + + " int foo(int p) {\n" + + " assert methodR" + + " }\n" + + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); + String str = this.workingCopies[0].getSource(); + String completeBehind = "methodR"; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + assertResults( + "methodReturningBlah[METHOD_REF]{methodReturningBlah(), Ltest.Test274466;, ()V, methodReturningBlah, " + + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + + "methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test274466;, ()Z, methodReturningBoolean, " + + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", + requestor.getResults()); +} }