### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java,v retrieving revision 1.115 diff -u -r1.115 CompletionTests_1_5.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 28 Apr 2009 17:46:11 -0000 1.115 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 13 May 2009 05:36:53 -0000 @@ -13622,6 +13622,7 @@ /* * https://bugs.eclipse.org/bugs/show_bug.cgi?id=84720 * to test that the methods with Boxed/unboxed return types get higher relevance than the ones that return void + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=273991 also */ public void testCompletionWithUnboxing() throws JavaModelException { this.workingCopies = new ICompilationUnit[2]; @@ -13631,16 +13632,20 @@ "public class C {\n" + "public void myMethod1(){}\n" + "public void myMethod2(){}\n" + - "public int myMethod3(){return 0;}\n" + - "public Integer myMethod4(){return 0;}\n" + + "public long myMethod3(){return 0;}\n" + + "public Long myMethod4(){return 0;}\n" + + "public float myMethod5(){return 0;}\n" + + "public Float myMethod6(){return 0;}\n" + + "public Double myMethod7(){return 0;}\n" + + "public double myMethod8(){return 0;}\n" + "public void foo() {\n" + - " int i = myMeth \n" + + " Long l = myMeth \n" + "}\n" + "}"); this.workingCopies[1] = getWorkingCopy( "/Completion/src3/java/lang/Test.java", "package java.lang;\n" + - "public class Integer {\n" + + "public class Long {\n" + "}"); CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); @@ -13654,10 +13659,18 @@ (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + "myMethod2[METHOD_REF]{myMethod2(), Ltest.C;, ()V, myMethod2, null, " + (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "myMethod4[METHOD_REF]{myMethod4(), Ltest.C;, ()Ljava.lang.Integer;, myMethod4, null, " + + "myMethod5[METHOD_REF]{myMethod5(), Ltest.C;, ()F, myMethod5, null, " + + (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + + "myMethod6[METHOD_REF]{myMethod6(), Ltest.C;, ()LFloat;, myMethod6, null, " + + (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + + "myMethod7[METHOD_REF]{myMethod7(), Ltest.C;, ()LDouble;, myMethod7, null, " + + (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + + "myMethod8[METHOD_REF]{myMethod8(), Ltest.C;, ()D, myMethod8, null, " + + (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + + "myMethod3[METHOD_REF]{myMethod3(), Ltest.C;, ()J, myMethod3, null, " + (R_RESOLVED + R_INTERESTING + R_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "myMethod3[METHOD_REF]{myMethod3(), Ltest.C;, ()I, myMethod3, null, " + - (R_RESOLVED + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", + "myMethod4[METHOD_REF]{myMethod4(), Ltest.C;, ()Ljava.lang.Long;, myMethod4, null, " + + (R_RESOLVED + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}" , requestor.getResults()); } /* @@ -13675,7 +13688,7 @@ "public int myMethod3(){return 0;}\n" + "public Integer myMethod4(){return 0;}\n" + "public void foo() {\n" + - " Integer i = myMeth \n" + + " int i = myMeth \n" + "}\n" + "}"); this.workingCopies[1] = getWorkingCopy( @@ -13696,9 +13709,9 @@ (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + "myMethod2[METHOD_REF]{myMethod2(), Ltest.C;, ()V, myMethod2, null, " + (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "myMethod3[METHOD_REF]{myMethod3(), Ltest.C;, ()I, myMethod3, null, " + - (R_RESOLVED + R_INTERESTING + R_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + "myMethod4[METHOD_REF]{myMethod4(), Ltest.C;, ()Ljava.lang.Integer;, myMethod4, null, " + + (R_RESOLVED + R_INTERESTING + R_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + + "myMethod3[METHOD_REF]{myMethod3(), Ltest.C;, ()I, myMethod3, null, " + (R_RESOLVED + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", requestor.getResults()); } #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 13 May 2009 05:37:02 -0000 @@ -3979,7 +3979,7 @@ } // Bug 84720 - [1.5][assist] proposal ranking by return value should consider auto(un)boxing // Just ensuring that the unitScope is not null, even though it's an unlikely case. - if (this.unitScope != null && this.unitScope.isBoxingCompatibleWith(this.expectedTypes[i], proposalType)) { + if (this.unitScope != null && this.unitScope.isBoxingCompatibleWith(proposalType, this.expectedTypes[i])) { relevance = R_EXPECTED_TYPE; } }