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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java (-12 / +22 lines)
Lines 13663-13689 Link Here
13663
/*
13663
/*
13664
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=84720
13664
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=84720
13665
 * Additional tests for bug 84720  
13665
 * Additional tests for bug 84720  
13666
 * 
13667
 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=273991 also
13666
 */
13668
 */
13667
public void testCompletionWithUnboxing_1() throws JavaModelException {
13669
public void testCompletionWithUnboxing_1() throws JavaModelException {
13668
	this.workingCopies = new ICompilationUnit[2];
13670
	this.workingCopies = new ICompilationUnit[3];
13669
	this.workingCopies[0] = getWorkingCopy(
13671
	this.workingCopies[0] = getWorkingCopy(
13670
			"/Completion/src3/test/Test.java",
13672
			"/Completion/src3/test/Test.java",
13671
			"package test;\n" +
13673
			"package test;\n" +
13672
			"public class C {\n" +
13674
			"public class C {\n" +
13673
			"public void myMethod1(){}\n" +
13675
			"public void myMethod1(){}\n" +
13674
			"public void myMethod2(){}\n" +
13676
			"public long myMethod2(){return 0;}\n" +
13675
			"public int myMethod3(){return 0;}\n" +
13677
			"public Long myMethod3(){return 0;}\n" +
13676
			"public Integer myMethod4(){return 0;}\n" +
13678
			"public float myMethod4(){return 0;}\n" +
13679
			"public Float myMethod5(){return 0;}\n" +
13677
			"public void foo() {\n" +
13680
			"public void foo() {\n" +
13678
			"	Integer i = myMeth \n" +
13681
			"	Long l = myMeth \n" +
13679
			"}\n" +
13682
			"}\n" +
13680
			"}");
13683
			"}");
13681
	this.workingCopies[1] = getWorkingCopy(
13684
	this.workingCopies[1] = getWorkingCopy(
13682
			"/Completion/src3/java/lang/Test.java",
13685
			"/Completion/src3/java/lang/Long.java",
13683
			"package java.lang;\n" +
13686
			"package java.lang;\n" +
13684
			"public class Integer {\n" +
13687
			"public class Long {\n" +
13685
			"}");
13688
			"}");
13686
13689
	this.workingCopies[2] = getWorkingCopy(
13690
			"/Completion/src3/java/lang/Float.java",
13691
			"package java.lang;\n" +
13692
			"public class Float {\n" +
13693
			"}");
13694
	
13687
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
13695
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
13688
13696
13689
	String str = this.workingCopies[0].getSource();
13697
	String str = this.workingCopies[0].getSource();
Lines 13694-13705 Link Here
13694
	assertResults(
13702
	assertResults(
13695
			"myMethod1[METHOD_REF]{myMethod1(), Ltest.C;, ()V, myMethod1, null, " +
13703
			"myMethod1[METHOD_REF]{myMethod1(), Ltest.C;, ()V, myMethod1, null, " +
13696
				(R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
13704
				(R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
13697
			"myMethod2[METHOD_REF]{myMethod2(), Ltest.C;, ()V, myMethod2, null, " +
13705
			"myMethod4[METHOD_REF]{myMethod4(), Ltest.C;, ()F, myMethod4, null, " +
13698
				(R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
13706
				(R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
13699
			"myMethod3[METHOD_REF]{myMethod3(), Ltest.C;, ()I, myMethod3, null, " +
13707
			"myMethod5[METHOD_REF]{myMethod5(), Ltest.C;, ()Ljava.lang.Float;, myMethod5, null, " +
13708
			(R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
13709
			"myMethod2[METHOD_REF]{myMethod2(), Ltest.C;, ()J, myMethod2, null, " +
13700
				(R_RESOLVED + R_INTERESTING + R_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
13710
				(R_RESOLVED + R_INTERESTING + R_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
13701
			"myMethod4[METHOD_REF]{myMethod4(), Ltest.C;, ()Ljava.lang.Integer;, myMethod4, null, " +
13711
			"myMethod3[METHOD_REF]{myMethod3(), Ltest.C;, ()Ljava.lang.Long;, myMethod3, null, " +
13702
				(R_RESOLVED + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
13712
				(R_RESOLVED + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}" ,
13703
			requestor.getResults());	
13713
			requestor.getResults());	
13704
}
13714
}
13705
/*
13715
/*
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-1 / +1 lines)
Lines 3979-3985 Link Here
3979
				}
3979
				}
3980
				// Bug 84720 - [1.5][assist] proposal ranking by return value should consider auto(un)boxing
3980
				// Bug 84720 - [1.5][assist] proposal ranking by return value should consider auto(un)boxing
3981
				// Just ensuring that the unitScope is not null, even though it's an unlikely case.
3981
				// Just ensuring that the unitScope is not null, even though it's an unlikely case.
3982
				if (this.unitScope != null && this.unitScope.isBoxingCompatibleWith(this.expectedTypes[i], proposalType)) {
3982
				if (this.unitScope != null && this.unitScope.isBoxingCompatibleWith(proposalType, this.expectedTypes[i])) {
3983
					relevance = R_EXPECTED_TYPE;
3983
					relevance = R_EXPECTED_TYPE;
3984
				}
3984
				}
3985
			}
3985
			}

Return to bug 273991