Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 133082 Details for
Bug 84720
[1.5][assist] proposal ranking by return value should consider auto(un)boxing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Latest patch
bug_84720_1.txt (text/plain), 7.10 KB, created by
Jay Arthanareeswaran
on 2009-04-24 05:14:35 EDT
(
hide
)
Description:
Latest patch
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2009-04-24 05:14:35 EDT
Size:
7.10 KB
patch
obsolete
>### 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.394 >diff -u -r1.394 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 17 Apr 2009 08:48:11 -0000 1.394 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 24 Apr 2009 08:21:59 -0000 >@@ -3977,6 +3977,11 @@ > > relevance = R_EXPECTED_TYPE; > } >+ // 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)) { >+ relevance = R_EXPECTED_TYPE; >+ } > } > return relevance; > } >#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.113 >diff -u -r1.113 CompletionTests_1_5.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 17 Apr 2009 08:48:15 -0000 1.113 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 24 Apr 2009 08:22:17 -0000 >@@ -13619,5 +13619,130 @@ > JavaCore.setOptions(this.oldOptions); > } > } >+/* >+ * 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 >+ */ >+public void testCompletionWithUnboxing() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ 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 void foo() {\n" + >+ " int i = myMeth \n" + >+ "}\n" + >+ "}"); >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/java/lang/Test.java", >+ "package java.lang;\n" + >+ "public class Integer {\n" + >+ "}"); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "= myMeth"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ 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, " + >+ (R_RESOLVED + R_INTERESTING + 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()); >+} >+/* >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=84720 >+ * Additional tests for bug 84720 >+ */ >+public void testCompletionWithUnboxing_1() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ 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 void foo() {\n" + >+ " Integer i = myMeth \n" + >+ "}\n" + >+ "}"); >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/java/lang/Test.java", >+ "package java.lang;\n" + >+ "public class Integer {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "= myMeth"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ 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, " + >+ (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_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+/* >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=84720 >+ * Additional tests for bug 84720 >+ */ >+public void testCompletionWithUnboxing_2() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class C {\n" + >+ "int myVariable1 = 0;\n" + >+ "long myVariable2 = 0;\n" + >+ "boolean myVariable3 = false;\n" + >+ "Boolean myVariable4 = false;\n" + >+ "public void foo() {\n" + >+ " if(myVar \n" + >+ "}\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/java/lang/Test.java", >+ "package java.lang;\n" + >+ "public class Boolean {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "if(myVar"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertResults( >+ "myVariable1[FIELD_REF]{myVariable1, Ltest.C;, I, myVariable1, null, " + >+ (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + >+ "myVariable2[FIELD_REF]{myVariable2, Ltest.C;, J, myVariable2, null, " + >+ (R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + >+ "myVariable4[FIELD_REF]{myVariable4, Ltest.C;, Ljava.lang.Boolean;, myVariable4, null, " + >+ (R_RESOLVED + R_INTERESTING + R_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + >+ "myVariable3[FIELD_REF]{myVariable3, Ltest.C;, Z, myVariable3, null, " + >+ (R_RESOLVED + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
david_audel
:
iplog+
david_audel
:
review+
Actions:
View
|
Diff
Attachments on
bug 84720
:
132897
| 133082