### 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 14 May 2009 09:04:29 -0000 @@ -13663,27 +13663,35 @@ /* * https://bugs.eclipse.org/bugs/show_bug.cgi?id=84720 * Additional tests for bug 84720 + * + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=273991 also */ public void testCompletionWithUnboxing_1() throws JavaModelException { - this.workingCopies = new ICompilationUnit[2]; + this.workingCopies = new ICompilationUnit[3]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test/Test.java", "package test;\n" + "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 myMethod2(){return 0;}\n" + + "public Long myMethod3(){return 0;}\n" + + "public float myMethod4(){return 0;}\n" + + "public Float myMethod5(){return 0;}\n" + "public void foo() {\n" + - " Integer i = myMeth \n" + + " Long l = myMeth \n" + "}\n" + "}"); this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/java/lang/Test.java", + "/Completion/src3/java/lang/Long.java", "package java.lang;\n" + - "public class Integer {\n" + + "public class Long {\n" + "}"); - + this.workingCopies[2] = getWorkingCopy( + "/Completion/src3/java/lang/Float.java", + "package java.lang;\n" + + "public class Float {\n" + + "}"); + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); String str = this.workingCopies[0].getSource(); @@ -13694,12 +13702,14 @@ assertResults( "myMethod1[METHOD_REF]{myMethod1(), Ltest.C;, ()V, myMethod1, null, " + (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "myMethod2[METHOD_REF]{myMethod2(), Ltest.C;, ()V, myMethod2, null, " + + "myMethod4[METHOD_REF]{myMethod4(), Ltest.C;, ()F, myMethod4, null, " + (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "myMethod3[METHOD_REF]{myMethod3(), Ltest.C;, ()I, myMethod3, null, " + + "myMethod5[METHOD_REF]{myMethod5(), Ltest.C;, ()Ljava.lang.Float;, myMethod5, null, " + + (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + + "myMethod2[METHOD_REF]{myMethod2(), Ltest.C;, ()J, myMethod2, 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_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", + "myMethod3[METHOD_REF]{myMethod3(), Ltest.C;, ()Ljava.lang.Long;, 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 14 May 2009 09:04:39 -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; } }