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 50171 Details for
Bug 73401
[search] Unable to search just for references to overridden method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v04.txt (text/plain), 25.72 KB, created by
Frederic Fusier
on 2006-09-14 13:10:36 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2006-09-14 13:10:36 EDT
Size:
25.72 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v >retrieving revision 1.84 >diff -u -r1.84 JavaSearchBugsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 7 Sep 2006 12:59:41 -0000 1.84 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 14 Sep 2006 16:52:50 -0000 >@@ -55,7 +55,6 @@ > } > } > class TypeReferencesCollector extends JavaSearchResultCollector { >- > protected IJavaElement getElement(SearchMatch searchMatch) { > IJavaElement element = super.getElement(searchMatch); > IJavaElement localElement = null; >@@ -6896,4 +6895,67 @@ > "b156177.B156177_I", > requestor); > } >+ >+/** >+ * Bug 156491: [1.5][search] interfaces and annotations could be found with only one requets of searchAllTypeName >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=156491" >+ */ >+public void testBug156491() throws CoreException { >+ resultCollector.showRule = true; >+ workingCopies = new ICompilationUnit[5]; >+ workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/pack/I.java", >+ "package pack;\n" + >+ "public interface I {}\n" >+ ); >+ workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/pack/X.java", >+ "package pack;\n" + >+ "public class X {\n" + >+ " public String toString() {\n" + >+ " return \"X\";\n" + >+ " }\n" + >+ "}\n" >+ ); >+ workingCopies[2] = getWorkingCopy("/JavaSearchBugs/src/pack/Sub.java", >+ "package pack;\n" + >+ "public class Sub extends X {}\n" >+ ); >+ workingCopies[3] = getWorkingCopy("/JavaSearchBugs/src/pack/Y.java", >+ "package pack;\n" + >+ "public class Y {\n" + >+ " public String toString() {\n" + >+ " return \"Y\";\n" + >+ " }\n" + >+ "}\n" >+ ); >+ workingCopies[4] = getWorkingCopy("/JavaSearchBugs/src/pack/Test.java", >+ "package pack;\n" + >+ "public class Test {\n" + >+ " void noMatch(Y y) {\n" + >+ " y.toString();\n" + >+ " toString();\n" + >+ " }\n" + >+ " void validMatches(X x) {\n" + >+ " x.toString();\n" + >+ " }\n" + >+ " void polymorphicSuper(Object o) {\n" + >+ " o.toString();\n" + >+ " }\n" + >+ " void polymorphicPotential(I i) {\n" + >+ " i.toString();\n" + >+ " }\n" + >+ " void polymorphicSub(Sub s) {\n" + >+ " s.toString();\n" + >+ " }\n" + >+ "}\n" >+ ); >+ IMethod method = workingCopies[1].getType("X").getMethod("toString", new String[0]); >+ this.resultCollector.showPolymorphic = 2; >+ search(method, REFERENCES); >+ assertSearchResults( >+ "src/pack/Test.java void pack.Test.validMatches(X) [toString()] EXACT_MATCH\n" + >+ "src/pack/Test.java void pack.Test.polymorphicSuper(Object) [toString()] EXACT_MATCH POLYMORPHIC\n" + >+ "src/pack/Test.java void pack.Test.polymorphicPotential(I) [toString()] POTENTIAL_MATCH POLYMORPHIC\n" + >+ "src/pack/Test.java void pack.Test.polymorphicSub(Sub) [toString()] EXACT_MATCH POLYMORPHIC" >+ ); >+} > } >\ No newline at end of file >Index: src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java,v >retrieving revision 1.17 >diff -u -r1.17 AbstractJavaSearchTests.java >--- src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java 29 Mar 2006 04:03:07 -0000 1.17 >+++ src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java 14 Sep 2006 16:52:46 -0000 >@@ -55,12 +55,15 @@ > public boolean showPotential = true; > public boolean showProject; > public boolean showSynthetic; >+ public int showPolymorphic = 0; > public int count = 0; > public void acceptSearchMatch(SearchMatch searchMatch) throws CoreException { > count++; > this.match = searchMatch; > writeLine(); >- writeLineToResult(); >+ if (line != null) { >+ writeLineToResult(); >+ } > } > protected void writeLineToResult() { > if (match.getAccuracy() == SearchMatch.A_ACCURATE || showPotential) { >@@ -211,6 +214,22 @@ > } > } > } >+ if (match instanceof MethodReferenceMatch) { >+ MethodReferenceMatch methRef = (MethodReferenceMatch) match; >+ if (methRef.isPolymorphic()) { >+ if (match.getAccuracy() == SearchMatch.A_ACCURATE) { >+ if (this.showPolymorphic > 0) { >+ line.append(" POLYMORPHIC"); >+ } >+ } else { >+ if (this.showPolymorphic <= 1) { >+ line = null; // do not show potential polymorphic matches >+ } else { >+ line.append(" POLYMORPHIC"); >+ } >+ } >+ } >+ } > } catch (JavaModelException e) { > results.append("\n"); > results.append(e.toString()); >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/internal/core/search/matching/MatchingNodeSet.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchingNodeSet.java,v >retrieving revision 1.34 >diff -u -r1.34 MatchingNodeSet.java >--- search/org/eclipse/jdt/internal/core/search/matching/MatchingNodeSet.java 10 May 2006 18:03:43 -0000 1.34 >+++ search/org/eclipse/jdt/internal/core/search/matching/MatchingNodeSet.java 14 Sep 2006 16:52:56 -0000 >@@ -54,18 +54,32 @@ > } > > public int addMatch(ASTNode node, int matchLevel) { >- switch (matchLevel & PatternLocator.NODE_SET_MASK) { >+ int maskedLevel = matchLevel & PatternLocator.MATCH_LEVEL_MASK; >+ switch (maskedLevel) { > case PatternLocator.INACCURATE_MATCH: >- addTrustedMatch(node, POTENTIAL_MATCH); >+ if (matchLevel != maskedLevel) { >+ addTrustedMatch(node, new Integer(SearchMatch.A_INACCURATE+(matchLevel & PatternLocator.FLAVORS_MASK))); >+ } else { >+ addTrustedMatch(node, POTENTIAL_MATCH); >+ } > break; > case PatternLocator.POSSIBLE_MATCH: > addPossibleMatch(node); > break; > case PatternLocator.ERASURE_MATCH: >- addTrustedMatch(node, ERASURE_MATCH); >+ if (matchLevel != maskedLevel) { >+ addTrustedMatch(node, new Integer(SearchPattern.R_ERASURE_MATCH+(matchLevel & PatternLocator.FLAVORS_MASK))); >+ } else { >+ addTrustedMatch(node, ERASURE_MATCH); >+ } > break; > case PatternLocator.ACCURATE_MATCH: >- addTrustedMatch(node, EXACT_MATCH); >+ if (matchLevel != maskedLevel) { >+ addTrustedMatch(node, new Integer(SearchMatch.A_ACCURATE+(matchLevel & PatternLocator.FLAVORS_MASK))); >+ } else { >+ addTrustedMatch(node, EXACT_MATCH); >+ } >+ break; > } > return matchLevel; > } >Index: search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java,v >retrieving revision 1.279 >diff -u -r1.279 MatchLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 7 Sep 2006 07:27:16 -0000 1.279 >+++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 14 Sep 2006 16:52:55 -0000 >@@ -1401,7 +1401,8 @@ > boolean insideDocComment = (reference.bits & ASTNode.InsideJavadoc) != 0; > if (enclosingBinding != null) > enclosingElement = ((JavaElement) enclosingElement).resolved(enclosingBinding); >- return new MethodReferenceMatch(enclosingElement, accuracy, offset, length, isConstructor, isSynthetic, insideDocComment, participant, resource); >+ boolean isPolymorphic = (accuracy & PatternLocator.POLYMORPHIC_FLAVOR) != 0; >+ return new MethodReferenceMatch(enclosingElement, accuracy, offset, length, isConstructor, isSynthetic, isPolymorphic, insideDocComment, participant, resource); > } > > public SearchMatch newPackageReferenceMatch( >@@ -1641,15 +1642,27 @@ > : "\tAccuracy: POTENTIAL_MATCH"); //$NON-NLS-1$ > System.out.print("\tRule: "); //$NON-NLS-1$ > if (match.isExact()) { >- System.out.println("EXACT"); //$NON-NLS-1$ >+ System.out.print("EXACT"); //$NON-NLS-1$ > } else if (match.isEquivalent()) { >- System.out.println("EQUIVALENT"); //$NON-NLS-1$ >+ System.out.print("EQUIVALENT"); //$NON-NLS-1$ > } else if (match.isErasure()) { >- System.out.println("ERASURE"); //$NON-NLS-1$ >+ System.out.print("ERASURE"); //$NON-NLS-1$ > } else { >- System.out.println("INVALID RULE"); //$NON-NLS-1$ >+ System.out.print("INVALID RULE"); //$NON-NLS-1$ > } >- System.out.println("\tRaw: "+match.isRaw()); //$NON-NLS-1$ >+ if (match instanceof MethodReferenceMatch) { >+ MethodReferenceMatch methodReferenceMatch = (MethodReferenceMatch) match; >+ if (methodReferenceMatch.isPolymorphic()) { >+ System.out.print("+POLYMORPHIC"); //$NON-NLS-1$ >+ } >+ if (methodReferenceMatch.isImplicit()) { >+ System.out.print("+IMPLICIT"); //$NON-NLS-1$ >+ } >+ if (methodReferenceMatch.isSynthetic()) { >+ System.out.print("+SYNTHETIC"); //$NON-NLS-1$ >+ } >+ } >+ System.out.println("\n\tRaw: "+match.isRaw()); //$NON-NLS-1$ > } > this.requestor.acceptSearchMatch(match); > if (BasicSearchEngine.VERBOSE) >Index: search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java,v >retrieving revision 1.59 >diff -u -r1.59 PatternLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 3 Aug 2006 17:23:54 -0000 1.59 >+++ search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 14 Sep 2006 16:52:56 -0000 >@@ -41,13 +41,14 @@ > > // Possible rule match flavors > // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=79866 >-protected static final int POSSIBLE_FULL_MATCH = POSSIBLE_MATCH | (SearchPattern.R_FULL_MATCH<<16); >-protected static final int POSSIBLE_PREFIX_MATCH = POSSIBLE_MATCH | (SearchPattern.R_PREFIX_MATCH<<16); >-protected static final int POSSIBLE_PATTERN_MATCH = POSSIBLE_MATCH | (SearchPattern.R_PATTERN_MATCH<<16); >-protected static final int POSSIBLE_REGEXP_MATCH = POSSIBLE_MATCH | (SearchPattern.R_REGEXP_MATCH<<16); >-protected static final int POSSIBLE_CAMELCASE_MATCH = POSSIBLE_MATCH | (SearchPattern.R_CAMELCASE_MATCH<<16); >-protected static final int NODE_SET_MASK = 0xFF; >-protected static final int POSSIBLE_MATCH_MASK = ~NODE_SET_MASK; >+protected static final int EXACT_FLAVOR = 0x0010; >+protected static final int PREFIX_FLAVOR = 0x0020; >+protected static final int PATTERN_FLAVOR = 0x0040; >+protected static final int REGEXP_FLAVOR = 0x0080; >+protected static final int CAMELCASE_FLAVOR = 0x0100; >+protected static final int POLYMORPHIC_FLAVOR = 0x0200; >+protected static final int MATCH_LEVEL_MASK = 0x0F; >+protected static final int FLAVORS_MASK = ~MATCH_LEVEL_MASK; > > /* match container */ > public static final int COMPILATION_UNIT_CONTAINER = 1; >@@ -251,10 +252,16 @@ > * @param name > * @return Possible values are: > * <ul> >- * <li>{@link #POSSIBLE_FULL_MATCH}: Given name is equals to pattern</li> >- * <li>{@link #POSSIBLE_PREFIX_MATCH}: Given name prefix equals to pattern</li> >- * <li>{@link #POSSIBLE_CAMELCASE_MATCH}: Given name matches pattern as Camel Case</li> >- * <li>{@link #POSSIBLE_PATTERN_MATCH}: Given name matches pattern as Pattern (ie. using '*' and '?' characters)</li> >+ * <li> {@link #ACCURATE_MATCH}</li> >+ * <li> {@link #IMPOSSIBLE_MATCH}</li> >+ * <li> {@link #POSSIBLE_MATCH} which may be flavored with following values: >+ * <ul> >+ * <li>{@link #EXACT_FLAVOR}: Given name is equals to pattern</li> >+ * <li>{@link #PREFIX_FLAVOR}: Given name prefix equals to pattern</li> >+ * <li>{@link #CAMELCASE_FLAVOR}: Given name matches pattern as Camel Case</li> >+ * <li>{@link #PATTERN_FLAVOR}: Given name matches pattern as Pattern (ie. using '*' and '?' characters)</li> >+ * </ul> >+ * </li> > * </ul> > */ > protected int matchNameValue(char[] pattern, char[] name) { >@@ -272,20 +279,20 @@ > boolean sameLength = pattern.length == name.length; > boolean canBePrefix = name.length >= pattern.length; > if (this.isCamelCase && matchFirstChar && CharOperation.camelCaseMatch(pattern, name)) { >- return POSSIBLE_CAMELCASE_MATCH; >+ return POSSIBLE_MATCH; > } > switch (this.matchMode) { > case SearchPattern.R_EXACT_MATCH: > if (!this.isCamelCase) { > if (sameLength && matchFirstChar && CharOperation.equals(pattern, name, this.isCaseSensitive)) { >- return POSSIBLE_FULL_MATCH; >+ return POSSIBLE_MATCH | EXACT_FLAVOR; > } > break; > } > // fall through next case to match as prefix if camel case failed > case SearchPattern.R_PREFIX_MATCH: > if (canBePrefix && matchFirstChar && CharOperation.prefixEquals(pattern, name, this.isCaseSensitive)) { >- return POSSIBLE_PREFIX_MATCH; >+ return POSSIBLE_MATCH; > } > break; > case SearchPattern.R_PATTERN_MATCH: >Index: search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java,v >retrieving revision 1.34 >diff -u -r1.34 PackageReferenceLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java 18 Apr 2006 16:28:18 -0000 1.34 >+++ search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java 14 Sep 2006 16:52:56 -0000 >@@ -99,7 +99,7 @@ > if (this.isCamelCase) { > packageName = CharOperation.concatWith(tokens, '.'); > if (CharOperation.camelCaseMatch(this.pattern.pkgName, packageName)) { >- return POSSIBLE_CAMELCASE_MATCH; >+ return POSSIBLE_MATCH; > } > } > switch (this.matchMode) { >@@ -107,7 +107,7 @@ > case SearchPattern.R_PREFIX_MATCH: > if (packageName==null) packageName = CharOperation.concatWith(tokens, '.'); > if (CharOperation.prefixEquals(this.pattern.pkgName, packageName, this.isCaseSensitive)) { >- return POSSIBLE_PREFIX_MATCH; >+ return POSSIBLE_MATCH; > } > break; > case SearchPattern.R_PATTERN_MATCH: >Index: search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java,v >retrieving revision 1.51 >diff -u -r1.51 TypeReferenceLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 25 Apr 2006 20:39:45 -0000 1.51 >+++ search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 14 Sep 2006 16:52:57 -0000 >@@ -113,13 +113,13 @@ > } > boolean matchFirstChar = !this.isCaseSensitive || (qualifiedPattern[0] == qualifiedTypeName[0]); > if (this.isCamelCase && matchFirstChar && CharOperation.camelCaseMatch(qualifiedPattern, qualifiedTypeName)) { >- return POSSIBLE_CAMELCASE_MATCH; >+ return POSSIBLE_MATCH; > } > switch (this.matchMode) { > case SearchPattern.R_EXACT_MATCH: > case SearchPattern.R_PREFIX_MATCH: > if (CharOperation.prefixEquals(qualifiedPattern, qualifiedTypeName, this.isCaseSensitive)) { >- return POSSIBLE_PREFIX_MATCH; >+ return POSSIBLE_MATCH; > } > break; > >Index: search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java,v >retrieving revision 1.67 >diff -u -r1.67 MethodLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 25 Apr 2006 20:39:45 -0000 1.67 >+++ search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 14 Sep 2006 16:52:56 -0000 >@@ -22,6 +22,7 @@ > import org.eclipse.jdt.internal.compiler.lookup.*; > import org.eclipse.jdt.internal.compiler.util.SimpleSet; > import org.eclipse.jdt.internal.core.JavaElement; >+import org.eclipse.jdt.internal.core.search.BasicSearchEngine; > > public class MethodLocator extends PatternLocator { > >@@ -47,6 +48,10 @@ > this.methodDeclarationsWithInvalidParam = new HashMap(); > } > public void initializePolymorphicSearch(MatchLocator locator) { >+ long start = 0; >+ if (BasicSearchEngine.VERBOSE) { >+ start = System.currentTimeMillis(); >+ } > try { > this.allSuperDeclaringTypeNames = > new SuperTypeNamesCollector( >@@ -59,6 +64,9 @@ > } catch (JavaModelException e) { > // inaccurate matches will be found > } >+ if (BasicSearchEngine.VERBOSE) { >+ System.out.println("Time to initialize polymorphic search: "+(System.currentTimeMillis()-start)); //$NON-NLS-1$ >+ } > } > /* > * Return whether a type name is in pattern all super declaring types names. >@@ -621,18 +629,31 @@ > if (qualifiedPattern == null) return methodLevel; // since any declaring class will do > > int declaringLevel; >- if (isVirtualInvoke(method, messageSend) && !(messageSend.actualReceiverType instanceof ArrayBinding)) { >- declaringLevel = resolveLevelAsSubtype(qualifiedPattern, method.declaringClass); >+ if (isVirtualInvoke(method, messageSend) && (messageSend.actualReceiverType instanceof ReferenceBinding)) { >+ ReferenceBinding methodReceiverType = (ReferenceBinding) messageSend.actualReceiverType; >+ declaringLevel = resolveLevelAsSubtype(qualifiedPattern, methodReceiverType); > if (declaringLevel == IMPOSSIBLE_MATCH) { > if (method.declaringClass == null || this.allSuperDeclaringTypeNames == null) { > declaringLevel = INACCURATE_MATCH; > } else { >- char[][] compoundName = method.declaringClass.compoundName; >- for (int i = 0, max = this.allSuperDeclaringTypeNames.length; i < max; i++) >- if (CharOperation.equals(this.allSuperDeclaringTypeNames[i], compoundName)) >- return methodLevel; // since this is an ACCURATE_MATCH so return the possibly weaker match >+ char[][] compoundName = methodReceiverType.compoundName; >+ for (int i = 0, max = this.allSuperDeclaringTypeNames.length; i < max; i++) { >+ if (CharOperation.equals(this.allSuperDeclaringTypeNames[i], compoundName)) { >+ return methodLevel // since this is an ACCURATE_MATCH so return the possibly weaker match >+ | POLYMORPHIC_FLAVOR; // this is a polymorphic method => add flavor to returned level >+ } >+ } >+ if (methodReceiverType.isInterface()) { >+ // all methods interface with same name and parameters are potential matches >+ // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=156491 >+ return INACCURATE_MATCH | POLYMORPHIC_FLAVOR; >+ } > } > } >+ if ((declaringLevel & FLAVORS_MASK) != 0) { >+ // level got some flavors => return it >+ return declaringLevel; >+ } > } else { > declaringLevel = resolveLevelForType(qualifiedPattern, method.declaringClass); > } >@@ -654,7 +675,7 @@ > // matches superclass > if (!type.isInterface() && !CharOperation.equals(type.compoundName, TypeConstants.JAVA_LANG_OBJECT)) { > level = resolveLevelAsSubtype(qualifiedPattern, type.superclass()); >- if (level != IMPOSSIBLE_MATCH) return level; >+ if (level != IMPOSSIBLE_MATCH) return level | POLYMORPHIC_FLAVOR; // this is a polymorphic method => add flavor to returned level > } > > // matches interfaces >@@ -662,7 +683,7 @@ > if (interfaces == null) return INACCURATE_MATCH; > for (int i = 0; i < interfaces.length; i++) { > level = resolveLevelAsSubtype(qualifiedPattern, interfaces[i]); >- if (level != IMPOSSIBLE_MATCH) return level; >+ if (level != IMPOSSIBLE_MATCH) return level | POLYMORPHIC_FLAVOR; // this is a polymorphic method => add flavor to returned level > } > return IMPOSSIBLE_MATCH; > } >Index: search/org/eclipse/jdt/core/search/MethodReferenceMatch.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java,v >retrieving revision 1.17 >diff -u -r1.17 MethodReferenceMatch.java >--- search/org/eclipse/jdt/core/search/MethodReferenceMatch.java 10 May 2006 18:03:46 -0000 1.17 >+++ search/org/eclipse/jdt/core/search/MethodReferenceMatch.java 14 Sep 2006 16:52:54 -0000 >@@ -25,6 +25,7 @@ > public class MethodReferenceMatch extends SearchMatch { > private boolean constructor; > private boolean synthetic; >+ private boolean polymorphic; > > /** > * Creates a new method reference match. >@@ -67,6 +68,30 @@ > } > > /** >+ * Creates a new method reference match. >+ * >+ * @param enclosingElement the inner-most enclosing member that references this method >+ * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} >+ * @param offset the offset the match starts at, or -1 if unknown >+ * @param length the length of the match, or -1 if unknown >+ * @param constructor <code>true</code> if this search matches a constructor >+ * <code>false</code> otherwise >+ * @param synthetic <code>true</code> if this search matches a synthetic element >+ * <code>false</code> otherwise >+ * @param polymorphic <code>true</code> if this search matches a polymorphic element >+ * <code>false</code> otherwise >+ * @param insideDocComment <code>true</code> if this search match is inside a doc >+ * comment, and <code>false</code> otherwise >+ * @param participant the search participant that created the match >+ * @param resource the resource of the element >+ * @since 3.3 >+ */ >+ public MethodReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean constructor, boolean synthetic, boolean polymorphic, boolean insideDocComment, SearchParticipant participant, IResource resource) { >+ this(enclosingElement, accuracy, offset, length, constructor, synthetic, insideDocComment, participant, resource); >+ this.polymorphic = polymorphic; >+ } >+ >+ /** > * Returns whether the reference is on a constructor. > * > * @return Returns whether the reference is on a constructor or not. >@@ -87,4 +112,16 @@ > public final boolean isSynthetic() { > return this.synthetic; > } >+ >+ /** >+ * Returns whether the reference is on a polymorphic method or not. >+ * Note that this field is only used for method reference. This happens when the reference >+ * is not implemented on the declaring class pattern but only on one of its superclass or subclass. >+ * >+ * @return <code>true</code> if the reference is a polymorphic method or not, >+ * <code>false </code> otherwise >+ */ >+ public boolean isPolymorphic() { >+ return this.polymorphic; >+ } > } >Index: search/org/eclipse/jdt/core/search/SearchMatch.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchMatch.java,v >retrieving revision 1.28 >diff -u -r1.28 SearchMatch.java >--- search/org/eclipse/jdt/core/search/SearchMatch.java 10 May 2006 18:03:46 -0000 1.28 >+++ search/org/eclipse/jdt/core/search/SearchMatch.java 14 Sep 2006 16:52:54 -0000 >@@ -57,9 +57,10 @@ > private boolean insideDocComment = false; > > // store the rule used while reporting the match >- private int rule = SearchPattern.R_FULL_MATCH | >+ private final static int ALL_GENERIC_FLAVORS = SearchPattern.R_FULL_MATCH | > SearchPattern.R_EQUIVALENT_MATCH | > SearchPattern.R_ERASURE_MATCH; >+ private int rule = ALL_GENERIC_FLAVORS; > > // store other necessary information > private boolean raw = false; >@@ -91,7 +92,11 @@ > this.length = length; > this.accuracy = accuracy & A_INACCURATE; > if (accuracy > A_INACCURATE) { >- this.rule = accuracy & ~A_INACCURATE; // accuracy may have also some rule information >+ int genericFlavors = accuracy & ALL_GENERIC_FLAVORS; >+ if (genericFlavors > 0) { >+ this.rule &= ~ALL_GENERIC_FLAVORS; // reset generic flavors >+ } >+ this.rule |= accuracy & ~A_INACCURATE; // accuracy may have also some rule information > } > this.participant = participant; > this.resource = resource; >Index: buildnotes_jdt-core.html >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/buildnotes_jdt-core.html,v >retrieving revision 1.5406 >diff -u -r1.5406 buildnotes_jdt-core.html >--- buildnotes_jdt-core.html 14 Sep 2006 03:04:29 -0000 1.5406 >+++ buildnotes_jdt-core.html 14 Sep 2006 16:52:54 -0000 >@@ -52,10 +52,33 @@ > (<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_713">cvs</a>). > <h2>What's new in this drop</h2> > <ul> >+<li>Added <code>isPolymorphic()</code> getters to MethodReferenceMatch. >+<br> >+When a search requestor (<code>SearchRequestor</code>) accepts this kind of match, >+it knows if a method reference match is a polymorphic method (ie. implemented in a superclass or a subclass) or not. >+<br> >+In example below: >+<pre> >+public class X { >+ public String toString() {} >+} >+public class Test { >+ void foo(Object o) { >+ o.toString(); >+ } >+} >+</pre> >+Searching for reference to <code>X.toString()</code> method will get a polymorphic MethodReferenceMatch >+as the reference is the Object.toString() method (found in a superclass of X)... >+</li> > </ul> > > <h3>Problem Reports Fixed</h3> >-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=157247">157247</a> >+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=156491">156491</a> >+[search] Reference search unusable in some situations >+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73401">73401</a> >+[search] Unable to search just for references to overridden method >+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=157247">157247</a> > [1.6] [compiler] VerifyError with StackMap frames when no local variable attributes are generated > <br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=157086">157086</a> > should adopt ICU Collator and use new APIs on StructuredViewer
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 73401
: 50171