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 94359 Details for
Bug 219099
Content assist does not not offer multiple choices for ambiguous static imports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug219099_002.txt (text/plain), 7.46 KB, created by
David Audel
on 2008-04-01 09:32:36 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2008-04-01 09:32:36 EDT
Size:
7.46 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.179 >diff -u -r1.179 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 13 Mar 2008 09:48:38 -0000 1.179 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 1 Apr 2008 13:31:42 -0000 >@@ -16958,6 +16958,96 @@ > JavaCore.setOptions(oldOptions); > } > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=219099 >+public void testFavoriteImports032() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZA.java", >+ "package test.p;\n" + >+ "public class ZZZA {\n" + >+ " public static int foo(int i){return 0;};\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZB.java", >+ "package test.p;\n" + >+ "public class ZZZB {\n" + >+ " public static int foo(int i){return 0;};\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZA.*", "test.p.ZZZB.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{ZZZA.foo(), Ltest.p.ZZZA;, (I)I, foo, (i), ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZA[TYPE_IMPORT]{import test.p.ZZZA;\n, test.p, Ltest.p.ZZZA;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + >+ "foo[METHOD_REF]{ZZZB.foo(), Ltest.p.ZZZB;, (I)I, foo, (i), ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZB[TYPE_IMPORT]{import test.p.ZZZB;\n, test.p, Ltest.p.ZZZB;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=219099 >+public void testFavoriteImports033() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public static int foo(int i){return 0;};\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZA.java", >+ "package test.p;\n" + >+ "public class ZZZA {\n" + >+ " public static int foo(int i){return 0;};\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZB.java", >+ "package test.p;\n" + >+ "public class ZZZB {\n" + >+ " public static int foo(int i){return 0;};\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZA.*", "test.p.ZZZB.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED; >+ int start = str.lastIndexOf("foo") + "".length(); >+ int end = start + "foo".length(); >+ assertResults( >+ "foo[METHOD_REF]{foo(), Ltest.Test;, (I)I, foo, (i), ["+start+", "+end+"], " + (relevance) + "}", >+ requestor.getResults()); >+} > public void testInconsistentHierarchy1() throws CoreException, IOException { > this.workingCopies = new ICompilationUnit[1]; > this.workingCopies[0] = getWorkingCopy( >#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.357 >diff -u -r1.357 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 21 Mar 2008 14:16:52 -0000 1.357 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 1 Apr 2008 13:31:46 -0000 >@@ -4123,6 +4123,8 @@ > ObjectVector fieldsFound, > ObjectVector methodsFound) { > >+ ObjectVector methodsFoundFromFavorites = new ObjectVector(); >+ > ImportBinding[] favoriteBindings = getFavoriteReferenceBindings(invocationScope); > > if (favoriteBindings != null && favoriteBindings.length > 0) { >@@ -4157,6 +4159,7 @@ > methods, > scope, > methodsFound, >+ methodsFoundFromFavorites, > methodBinding.declaringClass, > invocationSite, > invocationScope); >@@ -4179,6 +4182,7 @@ > referenceBinding.availableMethods(), > scope, > methodsFound, >+ methodsFoundFromFavorites, > referenceBinding, > invocationSite, > invocationScope); >@@ -4187,6 +4191,8 @@ > } > } > } >+ >+ methodsFound.addAll(methodsFoundFromFavorites); > } > > private boolean findFieldsAndMethodsFromMissingFieldType( >@@ -6077,6 +6083,7 @@ > MethodBinding[] methods, > Scope scope, > ObjectVector methodsFound, >+ ObjectVector methodsFoundFromFavorites, > ReferenceBinding receiverType, > InvocationSite invocationSite, > Scope invocationScope) { >@@ -6111,6 +6118,20 @@ > continue next; > } > >+ for (int i = methodsFoundFromFavorites.size; --i >= 0;) { >+ Object[] other = (Object[]) methodsFoundFromFavorites.elementAt(i); >+ MethodBinding otherMethod = (MethodBinding) other[0]; >+ >+ if (method == otherMethod) continue next; >+ >+ if (CharOperation.equals(method.selector, otherMethod.selector, true)) { >+ if (otherMethod.declaringClass == method.declaringClass && >+ lookupEnvironment.methodVerifier().isMethodSubsignature(otherMethod, method)) { >+ continue next; >+ } >+ } >+ } >+ > for (int i = methodsFound.size; --i >= 0;) { > Object[] other = (Object[]) methodsFound.elementAt(i); > MethodBinding otherMethod = (MethodBinding) other[0]; >@@ -6144,7 +6165,7 @@ > } > } > >- methodsFound.add(new Object[]{method, receiverType}); >+ methodsFoundFromFavorites.add(new Object[]{method, receiverType}); > > ReferenceBinding superTypeWithSameErasure = (ReferenceBinding)receiverType.findSuperTypeOriginatingFrom(method.declaringClass); > if (method.declaringClass != superTypeWithSameErasure) {
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
Actions:
View
|
Diff
Attachments on
bug 219099
: 94359