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 18384 Details for
Bug 86901
[1.5][search] Static import method references not found in unused import
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch for the implementation of this functionality
v00.txt (text/plain), 15.88 KB, created by
Frederic Fusier
on 2005-03-01 12:29:26 EST
(
hide
)
Description:
Patch for the implementation of this functionality
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2005-03-01 12:29:26 EST
Size:
15.88 KB
patch
obsolete
>Index: model/org/eclipse/jdt/internal/compiler/SourceElementParser.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java,v >retrieving revision 1.41 >diff -u -r1.41 SourceElementParser.java >--- model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 23 Feb 2005 02:47:29 -0000 1.41 >+++ model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 1 Mar 2005 16:25:15 -0000 >@@ -449,7 +449,12 @@ > // => accept unknown ref on identifier > int length = impt.tokens.length-1; > int start = (int) (impt.sourcePositions[length] >>> 32); >- requestor.acceptUnknownReference(impt.tokens[length], start); >+ char[] last = impt.tokens[length]; >+ // accept all possible kind for last name, index users will have to select the right one... >+ // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=86901 >+ requestor.acceptFieldReference(last, start); >+ requestor.acceptMethodReference(last, 0,start); >+ requestor.acceptTypeReference(last, start); > // accept type name > if (length > 0) { > char[][] compoundName = new char[length][]; >Index: search/org/eclipse/jdt/core/search/SearchPattern.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java,v >retrieving revision 1.36 >diff -u -r1.36 SearchPattern.java >--- search/org/eclipse/jdt/core/search/SearchPattern.java 27 Feb 2005 23:20:18 -0000 1.36 >+++ search/org/eclipse/jdt/core/search/SearchPattern.java 1 Mar 2005 16:25:20 -0000 >@@ -696,7 +696,6 @@ > parameterTypeQualifications, > parameterTypeSimpleNames, > parameterTypeSignatures, >- false, > typeArguments, > matchRule); > } else { >@@ -713,7 +712,6 @@ > parameterTypeQualifications, > parameterTypeSimpleNames, > parameterTypeSignatures, >- false, > typeArguments, > matchRule); > } >@@ -1018,7 +1016,6 @@ > char[] selector = method.getElementName().toCharArray(); > char[] returnSimpleName; > char[] returnQualification; >- boolean varargs = false; > String returnSignature; > try { > returnSignature = method.getReturnType(); >@@ -1036,7 +1033,6 @@ > CharOperation.concat(IIndexConstants.ONE_STAR, returnQualification); > } > } >- varargs = Flags.isVarargs(method.getFlags()); > } catch (JavaModelException e) { > return null; > } >@@ -1087,7 +1083,6 @@ > parameterSimpleNames, > parameterSignatures, > method, >- varargs, > matchRule); > } else { > searchPattern = >@@ -1103,7 +1098,6 @@ > parameterQualifications, > parameterSimpleNames, > parameterSignatures, >- varargs, > method, > matchRule); > } >Index: search/org/eclipse/jdt/internal/core/index/DiskIndex.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java,v >retrieving revision 1.21 >diff -u -r1.21 DiskIndex.java >--- search/org/eclipse/jdt/internal/core/index/DiskIndex.java 1 Mar 2005 12:13:02 -0000 1.21 >+++ search/org/eclipse/jdt/internal/core/index/DiskIndex.java 1 Mar 2005 16:25:22 -0000 >@@ -13,6 +13,7 @@ > import java.io.*; > > import org.eclipse.jdt.core.search.*; >+import org.eclipse.jdt.internal.core.search.matching.JavaSearchPattern; > import org.eclipse.jdt.internal.core.util.*; > import org.eclipse.jdt.internal.compiler.util.HashtableOfIntValues; > import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; >@@ -140,7 +141,8 @@ > if (this.categoryOffsets == null) > return results; // file is empty > >- if (matchRule == SearchPattern.R_EXACT_MATCH + SearchPattern.R_CASE_SENSITIVE) { >+ int rule = matchRule & JavaSearchPattern.MATCH_RULE_INDEX_MASK; >+ if (rule == SearchPattern.R_EXACT_MATCH + SearchPattern.R_CASE_SENSITIVE) { > for (int i = 0, l = categories.length; i < l; i++) { > HashtableOfObject wordsToDocNumbers = readCategoryTable(categories[i], false); > if (wordsToDocNumbers != null && wordsToDocNumbers.containsKey(key)) >Index: search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java,v >retrieving revision 1.18 >diff -u -r1.18 ConstructorLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java 27 Feb 2005 23:00:11 -0000 1.18 >+++ search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java 1 Mar 2005 16:25:23 -0000 >@@ -35,7 +35,7 @@ > if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH; > if (!(node instanceof ExplicitConstructorCall)) return IMPOSSIBLE_MATCH; > >- if (this.pattern.parameterSimpleNames != null && !this.pattern.varargs) { >+ if (this.pattern.parameterSimpleNames != null && this.pattern.shouldCountParameter()) { > int length = this.pattern.parameterSimpleNames.length; > Expression[] args = ((ExplicitConstructorCall) node).arguments; > int argsLength = args == null ? 0 : args.length; >@@ -60,7 +60,7 @@ > if (this.pattern.declaringSimpleName != null && !matchesName(this.pattern.declaringSimpleName, typeName[typeName.length-1])) > return IMPOSSIBLE_MATCH; > >- if (this.pattern.parameterSimpleNames != null && !this.pattern.varargs) { >+ if (this.pattern.parameterSimpleNames != null && this.pattern.shouldCountParameter()) { > int length = this.pattern.parameterSimpleNames.length; > Expression[] args = allocation.arguments; > int argsLength = args == null ? 0 : args.length; >@@ -80,7 +80,7 @@ > return IMPOSSIBLE_MATCH; > } > >- if (this.pattern.parameterSimpleNames != null && !this.pattern.varargs) { >+ if (this.pattern.parameterSimpleNames != null && this.pattern.shouldCountParameter()) { > int length = this.pattern.parameterSimpleNames.length; > Expression[] args = allocation.arguments; > int argsLength = args == null ? 0 : args.length; >Index: search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java,v >retrieving revision 1.27 >diff -u -r1.27 ConstructorPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java 23 Feb 2005 02:47:46 -0000 1.27 >+++ search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java 1 Mar 2005 16:25:24 -0000 >@@ -13,7 +13,9 @@ > import java.io.IOException; > > import org.eclipse.jdt.core.BindingKey; >+import org.eclipse.jdt.core.Flags; > import org.eclipse.jdt.core.IMethod; >+import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.core.search.SearchPattern; > import org.eclipse.jdt.internal.core.index.EntryResult; >@@ -32,7 +34,7 @@ > public char[][] parameterQualifications; > public char[][] parameterSimpleNames; > public int parameterCount; >-public boolean varargs; >+public int flags = 0; > > // Signatures and arguments for generic search > char[][][] parametersTypeSignatures; >@@ -65,7 +67,6 @@ > char[] declaringQualification, > char[][] parameterQualifications, > char[][] parameterSimpleNames, >- boolean varargs, > int matchRule) { > > this(matchRule); >@@ -86,7 +87,6 @@ > } else { > this.parameterCount = -1; > } >- this.varargs = varargs; > ((InternalSearchPattern)this).mustResolve = mustResolve(); > } > /* >@@ -101,7 +101,7 @@ > char[][] parameterSimpleNames, > String[] parameterSignatures, > IMethod method, >- boolean varargs, >+// boolean varargs, > int matchRule) { > > this(findDeclarations, >@@ -110,9 +110,15 @@ > declaringQualification, > parameterQualifications, > parameterSimpleNames, >- varargs, > matchRule); > >+ // Set flags >+ try { >+ this.flags = method.getFlags(); >+ } catch (JavaModelException e) { >+ // do nothing >+ } >+ > // Get unique key for parameterized constructors > String genericDeclaringTypeSignature = null; > BindingKey key; >@@ -159,7 +165,6 @@ > char[][] parameterQualifications, > char[][] parameterSimpleNames, > String[] parameterSignatures, >- boolean varargs, > char[][] arguments, > int matchRule) { > >@@ -169,7 +174,6 @@ > declaringQualification, > parameterQualifications, > parameterSimpleNames, >- varargs, > matchRule); > > // Store type signature and arguments for declaring type >@@ -226,7 +230,7 @@ > public boolean matchesDecodedKey(SearchPattern decodedPattern) { > ConstructorPattern pattern = (ConstructorPattern) decodedPattern; > >- return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 || this.varargs) >+ return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 || !shouldCountParameter()) > && matchesName(this.declaringSimpleName, pattern.declaringSimpleName); > } > protected boolean mustResolve() { >@@ -244,7 +248,7 @@ > > switch(getMatchMode()) { > case R_EXACT_MATCH : >- if (!this.varargs && this.declaringSimpleName != null && this.parameterCount >= 0) >+ if (shouldCountParameter() && this.declaringSimpleName != null && this.parameterCount >= 0) > key = createIndexKey(this.declaringSimpleName, this.parameterCount); > else // do a prefix query with the declaringSimpleName > matchRule = matchRule - R_EXACT_MATCH + R_PREFIX_MATCH; >@@ -253,7 +257,7 @@ > // do a prefix query with the declaringSimpleName > break; > case R_PATTERN_MATCH : >- if (!this.varargs && this.parameterCount >= 0) >+ if (shouldCountParameter() && this.parameterCount >= 0) > key = createIndexKey(this.declaringSimpleName == null ? ONE_STAR : this.declaringSimpleName, this.parameterCount); > else if (this.declaringSimpleName != null && this.declaringSimpleName[this.declaringSimpleName.length - 1] != '*') > key = CharOperation.concat(this.declaringSimpleName, ONE_STAR, SEPARATOR); >@@ -290,5 +294,8 @@ > } > output.append(')'); > return super.print(output); >+} >+boolean shouldCountParameter() { >+ return (this.flags & Flags.AccStatic) == 0 && (this.flags & Flags.AccVarargs) == 0; > } > } >Index: search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java,v >retrieving revision 1.20 >diff -u -r1.20 DeclarationOfReferencedMethodsPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java 23 Feb 2005 02:47:46 -0000 1.20 >+++ search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java 1 Mar 2005 16:25:24 -0000 >@@ -21,7 +21,7 @@ > protected SimpleSet knownMethods; > > public DeclarationOfReferencedMethodsPattern(IJavaElement enclosingElement) { >- super(false, true, null, null, null, null, null, null, null, false, null, R_PATTERN_MATCH); >+ super(false, true, null, null, null, null, null, null, null, null, R_PATTERN_MATCH); > > this.enclosingElement = enclosingElement; > this.knownMethods = new SimpleSet(); >Index: search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java,v >retrieving revision 1.38 >diff -u -r1.38 MethodLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 1 Mar 2005 11:36:15 -0000 1.38 >+++ search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 1 Mar 2005 16:25:26 -0000 >@@ -110,7 +110,7 @@ > if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH; > > if (!matchesName(this.pattern.selector, node.selector)) return IMPOSSIBLE_MATCH; >- if (this.pattern.parameterSimpleNames != null && !this.pattern.varargs) { >+ if (this.pattern.parameterSimpleNames != null && this.pattern.shouldCountParameter()) { > int length = this.pattern.parameterSimpleNames.length; > ASTNode[] args = node.arguments; > int argsLength = args == null ? 0 : args.length; >Index: search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java,v >retrieving revision 1.49 >diff -u -r1.49 MethodPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java 23 Feb 2005 02:47:46 -0000 1.49 >+++ search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java 1 Mar 2005 16:25:26 -0000 >@@ -35,7 +35,7 @@ > public char[][] parameterQualifications; > public char[][] parameterSimpleNames; > public int parameterCount; >-public boolean varargs; >+public int flags = 0; > > // extra reference info > protected IType declaringType; >@@ -76,7 +76,6 @@ > char[] returnSimpleName, > char[][] parameterQualifications, > char[][] parameterSimpleNames, >- boolean varargs, > IType declaringType, > int matchRule) { > >@@ -101,7 +100,6 @@ > } else { > this.parameterCount = -1; > } >- this.varargs = varargs; > this.declaringType = declaringType; > ((InternalSearchPattern)this).mustResolve = mustResolve(); > } >@@ -120,7 +118,6 @@ > char[][] parameterQualifications, > char[][] parameterSimpleNames, > String[] parameterSignatures, >- boolean varargs, > IMethod method, > int matchRule) { > >@@ -133,9 +130,15 @@ > returnSimpleName, > parameterQualifications, > parameterSimpleNames, >- varargs, > method.getDeclaringType(), > matchRule); >+ >+ // Set flags >+ try { >+ this.flags = method.getFlags(); >+ } catch (JavaModelException e) { >+ // do nothing >+ } > > // Get unique key for parameterized constructors > String genericDeclaringTypeSignature = null; >@@ -194,7 +197,6 @@ > char[][] parameterQualifications, > char[][] parameterSimpleNames, > String[] parameterSignatures, >- boolean varargs, > char[][] arguments, > int matchRule) { > >@@ -207,7 +209,6 @@ > returnSimpleName, > parameterQualifications, > parameterSimpleNames, >- varargs, > null, > matchRule); > >@@ -269,7 +270,7 @@ > public boolean matchesDecodedKey(SearchPattern decodedPattern) { > MethodPattern pattern = (MethodPattern) decodedPattern; > >- return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 || this.varargs) >+ return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 || !shouldCountParameter()) > && matchesName(this.selector, pattern.selector); > } > /** >@@ -297,7 +298,7 @@ > > switch(getMatchMode()) { > case R_EXACT_MATCH : >- if (!this.varargs && this.selector != null && this.parameterCount >= 0) >+ if (shouldCountParameter() && this.selector != null && this.parameterCount >= 0) > key = createIndexKey(this.selector, this.parameterCount); > else // do a prefix query with the selector > matchRule = matchRule - R_EXACT_MATCH + R_PREFIX_MATCH; >@@ -306,7 +307,7 @@ > // do a prefix query with the selector > break; > case R_PATTERN_MATCH : >- if (!this.varargs && this.parameterCount >= 0) >+ if (shouldCountParameter() && this.parameterCount >= 0) > key = createIndexKey(this.selector == null ? ONE_STAR : this.selector, this.parameterCount); > else if (this.selector != null && this.selector[this.selector.length - 1] != '*') > key = CharOperation.concat(this.selector, ONE_STAR, SEPARATOR); >@@ -355,5 +356,8 @@ > else if (returnQualification != null) > output.append("*"); //$NON-NLS-1$ > return super.print(output); >+} >+boolean shouldCountParameter() { >+ return (this.flags & Flags.AccStatic) == 0 && (this.flags & Flags.AccVarargs) == 0; > } > }
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 86901
: 18384