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 112906 Details for
Bug 247835
SearchPattern extends non-API type InternalSearchPattern
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
247835.txt (text/plain), 63.16 KB, created by
Jerome Lanneluc
on 2008-09-18 11:04:55 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-09-18 11:04:55 EDT
Size:
63.16 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java,v >retrieving revision 1.51 >diff -u -r1.51 FieldLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java 27 Jun 2008 16:03:59 -0000 1.51 >+++ search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java 18 Sep 2008 15:03:23 -0000 >@@ -46,7 +46,7 @@ > FieldPattern fieldPattern = (FieldPattern) this.pattern; > char[] declaringType = CharOperation.concat(fieldPattern.declaringQualification, fieldPattern.declaringSimpleName, '.'); > if (matchesName(declaringType, CharOperation.concatWith(compoundName, '.'))) { >- declarationsLevel = ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; >+ declarationsLevel = this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; > } > } > } >@@ -60,7 +60,7 @@ > // must be a write only access with an initializer > if (this.pattern.writeAccess && !this.pattern.readAccess && node.initialization != null) > if (matchesName(this.pattern.name, node.name)) >- referencesLevel = ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; >+ referencesLevel = this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; > > int declarationsLevel = IMPOSSIBLE_MATCH; > if (this.pattern.findDeclarations) { >@@ -69,7 +69,7 @@ > case AbstractVariableDeclaration.ENUM_CONSTANT : > if (matchesName(this.pattern.name, node.name)) > if (matchesTypeReference(((FieldPattern)this.pattern).typeSimpleName, node.type)) >- declarationsLevel = ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; >+ declarationsLevel = this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; > break; > } > } >@@ -131,7 +131,7 @@ > protected int matchReference(Reference node, MatchingNodeSet nodeSet, boolean writeOnlyAccess) { > if (node instanceof FieldReference) { > if (matchesName(this.pattern.name, ((FieldReference) node).token)) >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > return IMPOSSIBLE_MATCH; > } > return super.matchReference(node, nodeSet, writeOnlyAccess); >Index: search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedTypesPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedTypesPattern.java,v >retrieving revision 1.28 >diff -u -r1.28 DeclarationOfReferencedTypesPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedTypesPattern.java 10 May 2006 18:03:42 -0000 1.28 >+++ search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedTypesPattern.java 18 Sep 2008 15:03:23 -0000 >@@ -23,6 +23,6 @@ > > this.enclosingElement = enclosingElement; > this.knownTypes = new SimpleSet(); >- ((InternalSearchPattern)this).mustResolve = true; >+ this.mustResolve = true; > } > } >Index: search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java,v >retrieving revision 1.66 >diff -u -r1.66 MethodPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java 27 Jun 2008 16:04:00 -0000 1.66 >+++ search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java 18 Sep 2008 15:03:24 -0000 >@@ -119,7 +119,7 @@ > this.parameterCount = -1; > } > this.declaringType = declaringType; >- ((InternalSearchPattern)this).mustResolve = mustResolve(); >+ this.mustResolve = mustResolve(); > } > /* > * Instanciate a method pattern with signatures for generics search >@@ -195,7 +195,7 @@ > > // Store type signatures and arguments for method > this.methodArguments = extractMethodArguments(method); >- if (hasMethodArguments()) ((InternalSearchPattern)this).mustResolve = true; >+ if (hasMethodArguments()) this.mustResolve = true; > } > /* > * Instanciate a method pattern with signatures for generics search >@@ -253,7 +253,7 @@ > > // Store type signatures and arguments for method > this.methodArguments = arguments; >- if (hasMethodArguments()) ((InternalSearchPattern)this).mustResolve = true; >+ if (hasMethodArguments()) this.mustResolve = true; > } > public void decodeIndexKey(char[] key) { > int last = key.length - 1; >@@ -289,7 +289,7 @@ > boolean hasMethodParameters() { > return this.methodParameters; > } >-boolean isPolymorphicSearch() { >+public boolean isPolymorphicSearch() { > return this.findReferences; > } > public boolean matchesDecodedKey(SearchPattern decodedPattern) { >@@ -317,7 +317,7 @@ > if (this.parameterQualifications[i] != null) return true; > return false; > } >-EntryResult[] queryIn(Index index) throws IOException { >+public EntryResult[] queryIn(Index index) throws IOException { > char[] key = this.selector; // can be null > int matchRule = getMatchRule(); > >Index: search/org/eclipse/jdt/internal/core/search/matching/AndPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/AndPattern.java,v >retrieving revision 1.33 >diff -u -r1.33 AndPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/AndPattern.java 27 Jun 2008 16:04:00 -0000 1.33 >+++ search/org/eclipse/jdt/internal/core/search/matching/AndPattern.java 18 Sep 2008 15:03:23 -0000 >@@ -36,7 +36,7 @@ > > public AndPattern(SearchPattern leftPattern, SearchPattern rightPattern) { > super(AND_PATTERN, combinedMatchRule(leftPattern.getMatchRule(), rightPattern.getMatchRule())); >- ((InternalSearchPattern) this).mustResolve = ((InternalSearchPattern) leftPattern).mustResolve || ((InternalSearchPattern) rightPattern).mustResolve; >+ this.mustResolve = leftPattern.mustResolve || rightPattern.mustResolve; > > SearchPattern[] leftPatterns = leftPattern instanceof AndPattern ? ((AndPattern) leftPattern).patterns : null; > SearchPattern[] rightPatterns = rightPattern instanceof AndPattern ? ((AndPattern) rightPattern).patterns : null; >@@ -62,7 +62,7 @@ > /* (non-Javadoc) > * @see org.eclipse.jdt.internal.core.search.matching.InternalSearchPattern#currentPattern() > */ >-SearchPattern currentPattern() { >+public SearchPattern currentPattern() { > return this.patterns[this.current++]; > } > >Index: search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java,v >retrieving revision 1.15 >diff -u -r1.15 TypeDeclarationLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java 27 Jun 2008 16:04:00 -0000 1.15 >+++ search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java 18 Sep 2008 15:03:25 -0000 >@@ -33,7 +33,7 @@ > //public int match(Reference node, MatchingNodeSet nodeSet) - SKIP IT > public int match(TypeDeclaration node, MatchingNodeSet nodeSet) { > if (this.pattern.simpleName == null || matchesName(this.pattern.simpleName, node.name)) >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > > return IMPOSSIBLE_MATCH; > } >Index: search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java,v >retrieving revision 1.39 >diff -u -r1.39 QualifiedTypeDeclarationPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java 27 Jun 2008 16:04:00 -0000 1.39 >+++ search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java 18 Sep 2008 15:03:25 -0000 >@@ -26,7 +26,7 @@ > this.simpleName = (this.isCaseSensitive || this.isCamelCase) ? simpleName : CharOperation.toLowerCase(simpleName); > this.typeSuffix = typeSuffix; > >- ((InternalSearchPattern)this).mustResolve = this.qualification != null || typeSuffix != TYPE_SUFFIX; >+ this.mustResolve = this.qualification != null || typeSuffix != TYPE_SUFFIX; > } > public QualifiedTypeDeclarationPattern(char[] qualification, int qualificationMatchRule, char[] simpleName, char typeSuffix, int matchRule) { > this(qualification, simpleName, typeSuffix, matchRule); >Index: search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java,v >retrieving revision 1.46 >diff -u -r1.46 OrPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java 27 Jun 2008 16:04:00 -0000 1.46 >+++ search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java 18 Sep 2008 15:03:24 -0000 >@@ -29,8 +29,8 @@ > > public OrPattern(SearchPattern leftPattern, SearchPattern rightPattern) { > super(Math.max(leftPattern.getMatchRule(), rightPattern.getMatchRule())); >- ((InternalSearchPattern)this).kind = OR_PATTERN; >- ((InternalSearchPattern)this).mustResolve = ((InternalSearchPattern) leftPattern).mustResolve || ((InternalSearchPattern) rightPattern).mustResolve; >+ this.kind = OR_PATTERN; >+ this.mustResolve = leftPattern.mustResolve || rightPattern.mustResolve; > > SearchPattern[] leftPatterns = leftPattern instanceof OrPattern ? ((OrPattern) leftPattern).patterns : null; > SearchPattern[] rightPatterns = rightPattern instanceof OrPattern ? ((OrPattern) rightPattern).patterns : null; >@@ -53,12 +53,12 @@ > this.matchCompatibility |= ((JavaSearchPattern) this.patterns[i]).matchCompatibility; > } > } >- void findIndexMatches(Index index, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope, IProgressMonitor progressMonitor) throws IOException { >+ public void findIndexMatches(Index index, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope, IProgressMonitor progressMonitor) throws IOException { > // per construction, OR pattern can only be used with a PathCollector (which already gather results using a set) > try { > index.startQuery(); > for (int i = 0, length = this.patterns.length; i < length; i++) >- ((InternalSearchPattern)this.patterns[i]).findIndexMatches(index, requestor, participant, scope, progressMonitor); >+ this.patterns[i].findIndexMatches(index, requestor, participant, scope, progressMonitor); > } finally { > index.stopQuery(); > } >@@ -72,9 +72,9 @@ > return (this.matchCompatibility & R_ERASURE_MATCH) != 0; > } > >- boolean isPolymorphicSearch() { >+ public boolean isPolymorphicSearch() { > for (int i = 0, length = this.patterns.length; i < length; i++) >- if (((InternalSearchPattern) this.patterns[i]).isPolymorphicSearch()) return true; >+ if (this.patterns[i].isPolymorphicSearch()) return true; > return false; > } > >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.318 >diff -u -r1.318 MatchLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 17 Sep 2008 10:51:13 -0000 1.318 >+++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 18 Sep 2008 15:03:24 -0000 >@@ -166,7 +166,7 @@ > } > } > >-public static SearchDocument[] addWorkingCopies(InternalSearchPattern pattern, SearchDocument[] indexMatches, org.eclipse.jdt.core.ICompilationUnit[] copies, SearchParticipant participant) { >+public static SearchDocument[] addWorkingCopies(SearchPattern pattern, SearchDocument[] indexMatches, org.eclipse.jdt.core.ICompilationUnit[] copies, SearchParticipant participant) { > if (copies == null) return indexMatches; > // working copies take precedence over corresponding compilation units > HashMap workingCopyDocuments = workingCopiesThatCanSeeFocus(copies, pattern.focus, pattern.isPolymorphicSearch(), participant); >@@ -200,7 +200,7 @@ > return matches; > } > >-public static void setFocus(InternalSearchPattern pattern, IJavaElement focus) { >+public static void setFocus(SearchPattern pattern, IJavaElement focus) { > pattern.focus = focus; > } > >@@ -265,7 +265,7 @@ > /** > * Query a given index for matching entries. Assumes the sender has opened the index and will close when finished. > */ >-public static void findIndexMatches(InternalSearchPattern pattern, Index index, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope, IProgressMonitor monitor) throws IOException { >+public static void findIndexMatches(SearchPattern pattern, Index index, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope, IProgressMonitor monitor) throws IOException { > pattern.findIndexMatches(index, requestor, participant, scope, monitor); > } > >@@ -276,7 +276,7 @@ > return element; > } > >-public static IJavaElement projectOrJarFocus(InternalSearchPattern pattern) { >+public static IJavaElement projectOrJarFocus(SearchPattern pattern) { > return pattern == null || pattern.focus == null ? null : getProjectOrJar(pattern.focus); > } > >@@ -967,7 +967,7 @@ > initialize(javaProject, length); > > // create and resolve binding (equivalent to beginCompilation() in Compiler) >- boolean mustResolvePattern = ((InternalSearchPattern)this.pattern).mustResolve; >+ boolean mustResolvePattern = this.pattern.mustResolve; > boolean mustResolve = mustResolvePattern; > this.patternLocator.mayBeGeneric = this.options.sourceLevel >= ClassFileConstants.JDK1_5; > boolean bindingsWereCreated = mustResolve; >@@ -1206,7 +1206,7 @@ > } > previousJavaProject = javaProject; > } >- matchSet.add(new PossibleMatch(this, resource, openable, searchDocument, ((InternalSearchPattern) this.pattern).mustResolve)); >+ matchSet.add(new PossibleMatch(this, resource, openable, searchDocument,this.pattern.mustResolve)); > } > > // last project >@@ -1250,7 +1250,7 @@ > locatePackageDeclarations(patterns[i], participant, projects); > } > } else if (searchPattern instanceof PackageDeclarationPattern) { >- IJavaElement focus = ((InternalSearchPattern) searchPattern).focus; >+ IJavaElement focus = searchPattern.focus; > if (focus != null) { > if (encloses(focus)) { > SearchMatch match = new PackageDeclarationMatch(focus.getAncestor(IJavaElement.PACKAGE_FRAGMENT), SearchMatch.A_ACCURATE, -1, -1, participant, focus.getResource()); >@@ -1593,7 +1593,7 @@ > // Move getMethodBodies to #parseAndBuildings(...) method to allow possible match resolution management > //getMethodBodies(unit); > >- boolean mustResolve = (((InternalSearchPattern)this.pattern).mustResolve || possibleMatch.nodeSet.mustResolve); >+ boolean mustResolve = (this.pattern.mustResolve || possibleMatch.nodeSet.mustResolve); > if (bindingsWereCreated && mustResolve) { > if (unit.types != null) { > if (BasicSearchEngine.VERBOSE) >@@ -2139,7 +2139,7 @@ > enclosingElement = createHandle(method, parent); > } > if (encloses(enclosingElement)) { >- if (((InternalSearchPattern)this.pattern).mustResolve) { >+ if (this.pattern.mustResolve) { > // Visit only if the pattern must resolve > MemberDeclarationVisitor declarationVisitor = new MemberDeclarationVisitor(enclosingElement, nodes, nodeSet, this); > method.traverse(declarationVisitor, (ClassScope) null); >Index: search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java,v >retrieving revision 1.17 >diff -u -r1.17 SuperTypeReferenceLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java 27 Jun 2008 16:04:00 -0000 1.17 >+++ search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java 18 Sep 2008 15:03:25 -0000 >@@ -35,7 +35,7 @@ > //public int match(TypeDeclaration node, MatchingNodeSet nodeSet) - SKIP IT > public int match(TypeReference node, MatchingNodeSet nodeSet) { > if (this.pattern.superSimpleName == null) >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > > char[] typeRefSimpleName = null; > if (node instanceof SingleTypeReference) { >@@ -45,7 +45,7 @@ > typeRefSimpleName = tokens[tokens.length-1]; > } > if (matchesName(this.pattern.superSimpleName, typeRefSimpleName)) >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > > return IMPOSSIBLE_MATCH; > } >Index: search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java,v >retrieving revision 1.31 >diff -u -r1.31 JavaSearchPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java 27 Jun 2008 16:04:00 -0000 1.31 >+++ search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java 18 Sep 2008 15:03:23 -0000 >@@ -81,7 +81,7 @@ > > protected JavaSearchPattern(int patternKind, int matchRule) { > super(matchRule); >- ((InternalSearchPattern)this).kind = patternKind; >+ this.kind = patternKind; > // Use getMatchRule() instead of matchRule as super constructor may modify its value > // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=81377 > int rule = getMatchRule(); >Index: search/org/eclipse/jdt/internal/core/search/matching/IntersectingPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/IntersectingPattern.java,v >retrieving revision 1.4 >diff -u -r1.4 IntersectingPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/IntersectingPattern.java 27 Jun 2008 16:04:00 -0000 1.4 >+++ search/org/eclipse/jdt/internal/core/search/matching/IntersectingPattern.java 18 Sep 2008 15:03:23 -0000 >@@ -35,8 +35,8 @@ > try { > index.startQuery(); > do { >- SearchPattern pattern = ((InternalSearchPattern) this).currentPattern(); >- EntryResult[] entries = ((InternalSearchPattern)pattern).queryIn(index); >+ SearchPattern pattern = currentPattern(); >+ EntryResult[] entries = pattern.queryIn(index); > if (entries == null) return; > > SearchPattern decodedResult = pattern.getBlankPattern(); >@@ -71,7 +71,7 @@ > Object[] names = intersectedNames.values; > for (int i = 0, l = names.length; i < l; i++) > if (names[i] != null) >- ((InternalSearchPattern) this).acceptMatch((String) names[i], containerPath, separator, null/*no pattern*/, requestor, participant, scope); // AndPatterns cannot provide the decoded result >+ acceptMatch((String) names[i], containerPath, separator, null/*no pattern*/, requestor, participant, scope); // AndPatterns cannot provide the decoded result > } > /** > * Returns whether another query must be done. >Index: search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfAccessedFieldsPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfAccessedFieldsPattern.java,v >retrieving revision 1.25 >diff -u -r1.25 DeclarationOfAccessedFieldsPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfAccessedFieldsPattern.java 27 May 2008 23:46:42 -0000 1.25 >+++ search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfAccessedFieldsPattern.java 18 Sep 2008 15:03:23 -0000 >@@ -24,6 +24,6 @@ > > this.enclosingElement = enclosingElement; > this.knownFields = new SimpleSet(); >- ((InternalSearchPattern)this).mustResolve = true; >+ this.mustResolve = true; > } > } >Index: search/org/eclipse/jdt/internal/core/search/matching/VariableLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/VariableLocator.java,v >retrieving revision 1.10 >diff -u -r1.10 VariableLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/VariableLocator.java 30 Jan 2008 15:58:34 -0000 1.10 >+++ search/org/eclipse/jdt/internal/core/search/matching/VariableLocator.java 18 Sep 2008 15:03:25 -0000 >@@ -56,7 +56,7 @@ > protected int matchReference(Reference node, MatchingNodeSet nodeSet, boolean writeOnlyAccess) { > if (node instanceof NameReference) { > if (this.pattern.name == null) { >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > } else if (node instanceof SingleNameReference) { > if (matchesName(this.pattern.name, ((SingleNameReference) node).token)) > return nodeSet.addMatch(node, POSSIBLE_MATCH); >Index: search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java,v >retrieving revision 1.63 >diff -u -r1.63 SuperTypeReferencePattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java 27 Jun 2008 16:04:00 -0000 1.63 >+++ search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java 18 Sep 2008 15:03:25 -0000 >@@ -152,7 +152,7 @@ > > this.superQualification = this.isCaseSensitive ? superQualification : CharOperation.toLowerCase(superQualification); > this.superSimpleName = (this.isCaseSensitive || this.isCamelCase) ? superSimpleName : CharOperation.toLowerCase(superSimpleName); >- ((InternalSearchPattern)this).mustResolve = superQualification != null; >+ this.mustResolve = superQualification != null; > this.superRefKind = superRefKind; > } > public SuperTypeReferencePattern( >@@ -164,7 +164,7 @@ > > this(superQualification, superSimpleName, superRefKind, matchRule); > this.typeSuffix = typeSuffix; >- ((InternalSearchPattern)this).mustResolve = superQualification != null || typeSuffix != TYPE_SUFFIX; >+ this.mustResolve = superQualification != null || typeSuffix != TYPE_SUFFIX; > } > SuperTypeReferencePattern(int matchRule) { > super(SUPER_REF_PATTERN, matchRule); >@@ -241,7 +241,7 @@ > > return matchesName(this.superSimpleName, pattern.superSimpleName); > } >-EntryResult[] queryIn(Index index) throws IOException { >+public EntryResult[] queryIn(Index index) throws IOException { > char[] key = this.superSimpleName; // can be null > int matchRule = getMatchRule(); > >Index: search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java,v >retrieving revision 1.31 >diff -u -r1.31 FieldPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java 27 Jun 2008 16:03:59 -0000 1.31 >+++ search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java 18 Sep 2008 15:03:23 -0000 >@@ -49,7 +49,7 @@ > this.typeQualification = this.isCaseSensitive ? typeQualification : CharOperation.toLowerCase(typeQualification); > this.typeSimpleName = (this.isCaseSensitive || this.isCamelCase) ? typeSimpleName : CharOperation.toLowerCase(typeSimpleName); > >- ((InternalSearchPattern)this).mustResolve = mustResolve(); >+ this.mustResolve = mustResolve(); > } > /* > * Instantiate a field pattern with additional information for generic search >Index: search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java,v >retrieving revision 1.28 >diff -u -r1.28 ConstructorLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java 27 Jun 2008 16:04:00 -0000 1.28 >+++ search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java 18 Sep 2008 15:03:23 -0000 >@@ -38,7 +38,7 @@ > > if (!matchParametersCount(node, ((ExplicitConstructorCall) node).arguments)) return IMPOSSIBLE_MATCH; > >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > } > public int match(ConstructorDeclaration node, MatchingNodeSet nodeSet) { > int referencesLevel = this.pattern.findReferences ? matchLevelForReferences(node) : IMPOSSIBLE_MATCH; >@@ -58,7 +58,7 @@ > > if (!matchParametersCount(node, allocation.arguments)) return IMPOSSIBLE_MATCH; > >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > } > public int match(FieldDeclaration field, MatchingNodeSet nodeSet) { > if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH; >@@ -73,7 +73,7 @@ > > if (!matchParametersCount(field, allocation.arguments)) return IMPOSSIBLE_MATCH; > >- return nodeSet.addMatch(field, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(field, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > } > //public int match(MethodDeclaration node, MatchingNodeSet nodeSet) - SKIP IT > /** >@@ -83,7 +83,7 @@ > public int match(MessageSend msgSend, MatchingNodeSet nodeSet) { > if ((msgSend.bits & ASTNode.InsideJavadoc) == 0) return IMPOSSIBLE_MATCH; > if (this.pattern.declaringSimpleName == null || CharOperation.equals(msgSend.selector, this.pattern.declaringSimpleName)) { >- return nodeSet.addMatch(msgSend, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(msgSend, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > } > return IMPOSSIBLE_MATCH; > } >@@ -92,7 +92,7 @@ > if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH; > > // need to look for a generated default constructor >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > } > //public int match(TypeReference node, MatchingNodeSet nodeSet) - SKIP IT > >@@ -146,7 +146,7 @@ > int argsLength = args == null ? 0 : args.length; > if (length != argsLength) return IMPOSSIBLE_MATCH; > } >- return ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; >+ return this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; > } > protected int matchLevelForDeclarations(ConstructorDeclaration constructor) { > // constructor name is stored in selector field >@@ -165,7 +165,7 @@ > if (constructor.typeParameters == null || constructor.typeParameters.length != this.pattern.constructorArguments.length) return IMPOSSIBLE_MATCH; > } > >- return ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; >+ return this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; > } > boolean matchParametersCount(ASTNode node, Expression[] args) { > if (this.pattern.parameterSimpleNames != null && (!this.pattern.varargs || ((node.bits & ASTNode.InsideJavadoc) != 0))) { >Index: search/org/eclipse/jdt/internal/core/search/matching/InternalSearchPattern.java >=================================================================== >RCS file: search/org/eclipse/jdt/internal/core/search/matching/InternalSearchPattern.java >diff -N search/org/eclipse/jdt/internal/core/search/matching/InternalSearchPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/InternalSearchPattern.java 27 Jun 2008 16:04:00 -0000 1.14 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,103 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.jdt.internal.core.search.matching; >- >-import java.io.IOException; >- >-import org.eclipse.core.runtime.*; >-import org.eclipse.jdt.core.IJavaElement; >-import org.eclipse.jdt.core.search.*; >-import org.eclipse.jdt.internal.compiler.env.AccessRuleSet; >-import org.eclipse.jdt.internal.core.index.*; >-import org.eclipse.jdt.internal.core.search.*; >- >-/** >- * Internal search pattern implementation >- */ >-public abstract class InternalSearchPattern { >- >- /** >- * The focus element (used for reference patterns) >- */ >- IJavaElement focus; >- >- int kind; >- boolean mustResolve = true; >- >- void acceptMatch(String relativePath, String containerPath, char separator, SearchPattern pattern, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope) { >- >- if (scope instanceof JavaSearchScope) { >- JavaSearchScope javaSearchScope = (JavaSearchScope) scope; >- // Get document path access restriction from java search scope >- // Note that requestor has to verify if needed whether the document violates the access restriction or not >- AccessRuleSet access = javaSearchScope.getAccessRuleSet(relativePath, containerPath); >- if (access != JavaSearchScope.NOT_ENCLOSED) { // scope encloses the document path >- StringBuffer documentPath = new StringBuffer(containerPath.length() + 1 + relativePath.length()); >- documentPath.append(containerPath); >- documentPath.append(separator); >- documentPath.append(relativePath); >- if (!requestor.acceptIndexMatch(documentPath.toString(), pattern, participant, access)) >- throw new OperationCanceledException(); >- } >- } else { >- StringBuffer buffer = new StringBuffer(containerPath.length() + 1 + relativePath.length()); >- buffer.append(containerPath); >- buffer.append(separator); >- buffer.append(relativePath); >- String documentPath = buffer.toString(); >- if (scope.encloses(documentPath)) >- if (!requestor.acceptIndexMatch(documentPath, pattern, participant, null)) >- throw new OperationCanceledException(); >- >- } >- } >- SearchPattern currentPattern() { >- return (SearchPattern) this; >- } >- /** >- * Query a given index for matching entries. Assumes the sender has opened the index and will close when finished. >- */ >- void findIndexMatches(Index index, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope, IProgressMonitor monitor) throws IOException { >- if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); >- try { >- index.startQuery(); >- SearchPattern pattern = currentPattern(); >- EntryResult[] entries = ((InternalSearchPattern)pattern).queryIn(index); >- if (entries == null) return; >- >- SearchPattern decodedResult = pattern.getBlankPattern(); >- String containerPath = index.containerPath; >- char separator = index.separator; >- for (int i = 0, l = entries.length; i < l; i++) { >- if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); >- >- EntryResult entry = entries[i]; >- decodedResult.decodeIndexKey(entry.getWord()); >- if (pattern.matchesDecodedKey(decodedResult)) { >- // TODO (kent) some clients may not need the document names >- String[] names = entry.getDocumentNames(index); >- for (int j = 0, n = names.length; j < n; j++) >- acceptMatch(names[j], containerPath, separator, decodedResult, requestor, participant, scope); >- } >- } >- } finally { >- index.stopQuery(); >- } >- } >- boolean isPolymorphicSearch() { >- return false; >- } >- EntryResult[] queryIn(Index index) throws IOException { >- SearchPattern pattern = (SearchPattern) this; >- return index.query(pattern.getIndexCategories(), pattern.getIndexKey(), pattern.getMatchRule()); >- } >- >-} >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.74 >diff -u -r1.74 PatternLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 9 Sep 2008 15:39:07 -0000 1.74 >+++ search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 18 Sep 2008 15:03:25 -0000 >@@ -64,7 +64,7 @@ > public static final int RULE_MASK = RAW_MASK; // no other values for the while... > > public static PatternLocator patternLocator(SearchPattern pattern) { >- switch (((InternalSearchPattern)pattern).kind) { >+ switch (pattern.kind) { > case IIndexConstants.PKG_REF_PATTERN : > return new PackageReferenceLocator((PackageReferencePattern) pattern); > case IIndexConstants.PKG_DECL_PATTERN : >@@ -120,7 +120,7 @@ > this.isErasureMatch = (matchRule & SearchPattern.R_ERASURE_MATCH) != 0; > this.isEquivalentMatch = (matchRule & SearchPattern.R_EQUIVALENT_MATCH) != 0; > this.matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK; >- this.mustResolve = ((InternalSearchPattern)pattern).mustResolve; >+ this.mustResolve = pattern.mustResolve; > } > /* > * Clear caches >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.45 >diff -u -r1.45 PackageReferenceLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java 17 Sep 2008 10:51:13 -0000 1.45 >+++ search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java 18 Sep 2008 15:03:24 -0000 >@@ -312,9 +312,9 @@ > } > } > if (compoundName != null && matchesName(this.pattern.pkgName, CharOperation.concatWith(compoundName, '.'))) { >- if (((InternalSearchPattern) this.pattern).focus instanceof IPackageFragment && binding instanceof ReferenceBinding) { >+ if (this.pattern.focus instanceof IPackageFragment && binding instanceof ReferenceBinding) { > // check that type is located inside this instance of a package fragment >- if (!isDeclaringPackageFragment((IPackageFragment)((InternalSearchPattern) this.pattern).focus, (ReferenceBinding)binding)) >+ if (!isDeclaringPackageFragment((IPackageFragment) this.pattern.focus, (ReferenceBinding)binding)) > return IMPOSSIBLE_MATCH; > } > return ACCURATE_MATCH; >Index: search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java,v >retrieving revision 1.37 >diff -u -r1.37 PackageDeclarationPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java 27 Jun 2008 16:04:00 -0000 1.37 >+++ search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java 18 Sep 2008 15:03:24 -0000 >@@ -20,7 +20,7 @@ > super(PKG_DECL_PATTERN, matchRule); > this.pkgName = pkgName; > } >-EntryResult[] queryIn(Index index) { >+public EntryResult[] queryIn(Index index) { > // package declarations are not indexed > return null; > } >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.65 >diff -u -r1.65 TypeReferenceLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 27 Jun 2008 16:04:00 -0000 1.65 >+++ search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 18 Sep 2008 15:03:25 -0000 >@@ -66,7 +66,7 @@ > if (!(node instanceof NameReference)) return IMPOSSIBLE_MATCH; > > if (this.pattern.simpleName == null) >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > > if (node instanceof SingleNameReference) { > if (matchesName(this.pattern.simpleName, ((SingleNameReference) node).token)) >@@ -83,11 +83,11 @@ > //public int match(TypeDeclaration node, MatchingNodeSet nodeSet) - SKIP IT > public int match(TypeReference node, MatchingNodeSet nodeSet) { > if (this.pattern.simpleName == null) >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > > if (node instanceof SingleTypeReference) { > if (matchesName(this.pattern.simpleName, ((SingleTypeReference) node).token)) >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > } else { > char[][] tokens = ((QualifiedTypeReference) node).tokens; > for (int i = 0, max = tokens.length; i < max; i++) >@@ -485,7 +485,7 @@ > if (refBinding.isLocalType()) { > // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=82673 > LocalTypeBinding local = (LocalTypeBinding) refBinding.erasure(); >- IJavaElement focus = ((InternalSearchPattern)this.pattern).focus; >+ IJavaElement focus = this.pattern.focus; > if (focus != null && local.enclosingMethod != null && focus.getParent().getElementType() == IJavaElement.METHOD) { > IMethod method = (IMethod) focus.getParent(); > if (!CharOperation.equals(local.enclosingMethod.selector, method.getElementName().toCharArray())) { >Index: search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java,v >retrieving revision 1.82 >diff -u -r1.82 TypeReferencePattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java 27 Jun 2008 16:04:00 -0000 1.82 >+++ search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java 18 Sep 2008 15:03:25 -0000 >@@ -52,7 +52,7 @@ > else > this.segmentsSize = this.segments.length; > >- ((InternalSearchPattern)this).mustResolve = true; // always resolve (in case of a simple name reference being a potential match) >+ this.mustResolve = true; // always resolve (in case of a simple name reference being a potential match) > } > /* > * Instantiate a type reference pattern with additional information for generics search >Index: search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java,v >retrieving revision 1.14 >diff -u -r1.14 MultiTypeDeclarationPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java 27 Jun 2008 16:04:00 -0000 1.14 >+++ search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java 18 Sep 2008 15:03:24 -0000 >@@ -59,7 +59,7 @@ > } > this.typeSuffix = typeSuffix; > >- ((InternalSearchPattern)this).mustResolve = typeSuffix != TYPE_SUFFIX; // only used to report type declarations, not their positions >+ this.mustResolve = typeSuffix != TYPE_SUFFIX; // only used to report type declarations, not their positions > } > MultiTypeDeclarationPattern(int matchRule) { > super(TYPE_DECL_PATTERN, matchRule); >@@ -104,7 +104,7 @@ > break; > return count < max; > } >-EntryResult[] queryIn(Index index) throws IOException { >+public EntryResult[] queryIn(Index index) throws IOException { > if (this.simpleNames == null) { > // if no simple names then return all possible ones from index > return index.query(getIndexCategories(), null, -1); // match rule is irrelevant when the key is null >Index: search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java,v >retrieving revision 1.42 >diff -u -r1.42 ClassFileMatchLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java 9 Sep 2008 15:39:07 -0000 1.42 >+++ search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java 18 Sep 2008 15:03:23 -0000 >@@ -174,7 +174,7 @@ > > // Report as many accurate matches as possible > int accuracy = SearchMatch.A_ACCURATE; >- boolean mustResolve = ((InternalSearchPattern)pattern).mustResolve; >+ boolean mustResolve = pattern.mustResolve; > if (mustResolve) { > BinaryTypeBinding binding = locator.cacheBinaryType(binaryType, info); > if (binding != null) { >@@ -309,7 +309,7 @@ > */ > private void matchAnnotations(SearchPattern pattern, MatchLocator locator, ClassFile classFile, IBinaryType binaryType) throws CoreException { > // Only process TypeReference patterns >- switch (((InternalSearchPattern)pattern).kind) { >+ switch (pattern.kind) { > case TYPE_REF_PATTERN: > break; > case OR_PATTERN: >@@ -373,7 +373,7 @@ > * Default is to return false. > */ > boolean matchBinary(SearchPattern pattern, Object binaryInfo, IBinaryType enclosingBinaryType) { >- switch (((InternalSearchPattern)pattern).kind) { >+ switch (pattern.kind) { > case CONSTRUCTOR_PATTERN : > return matchConstructor((ConstructorPattern) pattern, binaryInfo, enclosingBinaryType); > case FIELD_PATTERN : >Index: search/org/eclipse/jdt/internal/core/search/matching/TypeParameterLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeParameterLocator.java,v >retrieving revision 1.3 >diff -u -r1.3 TypeParameterLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/TypeParameterLocator.java 27 Jun 2008 16:04:00 -0000 1.3 >+++ search/org/eclipse/jdt/internal/core/search/matching/TypeParameterLocator.java 18 Sep 2008 15:03:25 -0000 >@@ -37,7 +37,7 @@ > if (this.pattern.findReferences) { > if (node instanceof SingleTypeReference) { // Type parameter cannot be qualified > if (matchesName(this.pattern.name, ((SingleTypeReference) node).token)) { >- int level = ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; >+ int level = this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; > return nodeSet.addMatch(node, level); > } > } >@@ -52,7 +52,7 @@ > public int match(TypeParameter node, MatchingNodeSet nodeSet) { > if (this.pattern.findDeclarations) { > if (matchesName(this.pattern.name, node.name)) { >- int level = ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; >+ int level = this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; > return nodeSet.addMatch(node, level); > } > } >Index: search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java,v >retrieving revision 1.26 >diff -u -r1.26 DeclarationOfReferencedMethodsPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java 27 May 2008 23:46:43 -0000 1.26 >+++ search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java 18 Sep 2008 15:03:23 -0000 >@@ -26,6 +26,6 @@ > > this.enclosingElement = enclosingElement; > this.knownMethods = new SimpleSet(); >- ((InternalSearchPattern)this).mustResolve = true; >+ this.mustResolve = true; > } > } >Index: search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java,v >retrieving revision 1.66 >diff -u -r1.66 TypeDeclarationPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java 9 Sep 2008 15:39:07 -0000 1.66 >+++ search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java 18 Sep 2008 15:03:25 -0000 >@@ -152,7 +152,7 @@ > this.simpleName = (this.isCaseSensitive || this.isCamelCase) ? simpleName : CharOperation.toLowerCase(simpleName); > this.typeSuffix = typeSuffix; > >- ((InternalSearchPattern)this).mustResolve = (this.pkg != null && this.enclosingTypeNames != null) || typeSuffix != TYPE_SUFFIX; >+ this.mustResolve = (this.pkg != null && this.enclosingTypeNames != null) || typeSuffix != TYPE_SUFFIX; > } > TypeDeclarationPattern(int matchRule) { > super(TYPE_DECL_PATTERN, matchRule); >@@ -255,7 +255,7 @@ > } > return true; > } >-EntryResult[] queryIn(Index index) throws IOException { >+public EntryResult[] queryIn(Index index) throws IOException { > char[] key = this.simpleName; // can be null > int matchRule = getMatchRule(); > >Index: search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java,v >retrieving revision 1.22 >diff -u -r1.22 LocalVariableLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java 27 Jun 2008 16:04:00 -0000 1.22 >+++ search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java 18 Sep 2008 15:03:24 -0000 >@@ -28,13 +28,13 @@ > // must be a write only access with an initializer > if (this.pattern.writeAccess && !this.pattern.readAccess && node.initialization != null) > if (matchesName(this.pattern.name, node.name)) >- referencesLevel = ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; >+ referencesLevel = this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; > > int declarationsLevel = IMPOSSIBLE_MATCH; > if (this.pattern.findDeclarations) > if (matchesName(this.pattern.name, node.name)) > if (node.declarationSourceStart == getLocalVariable().declarationSourceStart) >- declarationsLevel = ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; >+ declarationsLevel = this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; > > return nodeSet.addMatch(node, referencesLevel >= declarationsLevel ? referencesLevel : declarationsLevel); // use the stronger match > } >Index: search/org/eclipse/jdt/internal/core/search/matching/SecondaryTypeDeclarationPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SecondaryTypeDeclarationPattern.java,v >retrieving revision 1.2 >diff -u -r1.2 SecondaryTypeDeclarationPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/SecondaryTypeDeclarationPattern.java 27 Jun 2008 16:04:00 -0000 1.2 >+++ search/org/eclipse/jdt/internal/core/search/matching/SecondaryTypeDeclarationPattern.java 18 Sep 2008 15:03:25 -0000 >@@ -40,7 +40,7 @@ > /* (non-Javadoc) > * @see org.eclipse.jdt.internal.core.search.matching.TypeDeclarationPattern#queryIn(org.eclipse.jdt.internal.core.index.Index) > */ >-EntryResult[] queryIn(Index index) throws IOException { >+public EntryResult[] queryIn(Index index) throws IOException { > return index.query(CATEGORIES, SECONDARY_PATTERN_KEY, R_PATTERN_MATCH | R_CASE_SENSITIVE); > } > >Index: search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java,v >retrieving revision 1.43 >diff -u -r1.43 ConstructorPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java 27 Jun 2008 16:04:00 -0000 1.43 >+++ search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java 18 Sep 2008 15:03:23 -0000 >@@ -112,7 +112,7 @@ > } else { > this.parameterCount = -1; > } >- ((InternalSearchPattern)this).mustResolve = mustResolve(); >+ this.mustResolve = mustResolve(); > } > /* > * Instanciate a method pattern with signatures for generics search >@@ -174,7 +174,7 @@ > > // Store type signatures and arguments for method > this.constructorArguments = extractMethodArguments(method); >- if (hasConstructorArguments()) ((InternalSearchPattern)this).mustResolve = true; >+ if (hasConstructorArguments()) this.mustResolve = true; > } > /* > * Instanciate a method pattern with signatures for generics search >@@ -223,7 +223,7 @@ > this.constructorArguments = getTypeArguments()[0]; > } > } >- if (hasConstructorArguments()) ((InternalSearchPattern)this).mustResolve = true; >+ if (hasConstructorArguments()) this.mustResolve = true; > } > public void decodeIndexKey(char[] key) { > int last = key.length - 1; >@@ -274,7 +274,7 @@ > if (this.parameterQualifications[i] != null) return true; > return this.findReferences; // need to check resolved default constructors and explicit constructor calls > } >-EntryResult[] queryIn(Index index) throws IOException { >+public EntryResult[] queryIn(Index index) throws IOException { > char[] key = this.declaringSimpleName; // can be null > int matchRule = getMatchRule(); > >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.85 >diff -u -r1.85 MethodLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 17 Sep 2008 10:51:13 -0000 1.85 >+++ search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 18 Sep 2008 15:03:24 -0000 >@@ -102,7 +102,7 @@ > System.arraycopy(importRef.tokens, 0, compoundName, 0, length); > char[] declaringType = CharOperation.concat(this.pattern.declaringQualification, this.pattern.declaringSimpleName, '.'); > if (matchesName(declaringType, CharOperation.concatWith(compoundName, '.'))) { >- declarationsLevel = ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; >+ declarationsLevel = this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH; > } > } > } >@@ -119,7 +119,7 @@ > if (!matchesName(this.pattern.selector, node.selector)) return IMPOSSIBLE_MATCH; > > // Verify parameters types >- boolean resolve = ((InternalSearchPattern)this.pattern).mustResolve; >+ boolean resolve = this.pattern.mustResolve; > if (this.pattern.parameterSimpleNames != null) { > int length = this.pattern.parameterSimpleNames.length; > ASTNode[] args = node.arguments; >@@ -129,7 +129,7 @@ > if (args != null && !matchesTypeReference(this.pattern.parameterSimpleNames[i], ((Argument) args[i]).type)) { > // Do not return as impossible when source level is at least 1.5 > if (this.mayBeGeneric) { >- if (!((InternalSearchPattern)this.pattern).mustResolve) { >+ if (!this.pattern.mustResolve) { > // Set resolution flag on node set in case of types was inferred in parameterized types from generic ones... > // (see bugs https://bugs.eclipse.org/bugs/show_bug.cgi?id=79990, 96761, 96763) > nodeSet.mustResolve = true; >@@ -156,7 +156,7 @@ > > if (!matchesName(this.pattern.selector, node.name)) return IMPOSSIBLE_MATCH; > >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > } > public int match(MessageSend node, MatchingNodeSet nodeSet) { > if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH; >@@ -169,7 +169,7 @@ > if (length != argsLength) return IMPOSSIBLE_MATCH; > } > >- return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > } > //public int match(Reference node, MatchingNodeSet nodeSet) - SKIP IT > public int match(Annotation node, MatchingNodeSet nodeSet) { >@@ -183,7 +183,7 @@ > pair = node.memberValuePairs()[i]; > if (matchesName(this.pattern.selector, pair.name)) { > ASTNode possibleNode = (node instanceof SingleMemberAnnotation) ? (ASTNode) node : pair; >- return nodeSet.addMatch(possibleNode, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); >+ return nodeSet.addMatch(possibleNode, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > } > } > return IMPOSSIBLE_MATCH; >@@ -337,7 +337,7 @@ > methodReferenceMatch.localElement(localElement); > this.match = methodReferenceMatch; > if (this.pattern.findReferences && reference instanceof MessageSend) { >- IJavaElement focus = ((InternalSearchPattern) this.pattern).focus; >+ IJavaElement focus = this.pattern.focus; > // verify closest match if pattern was bound > // (see bug 70827) > if (focus != null && focus.getElementType() == IJavaElement.METHOD) { >Index: search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java,v >retrieving revision 1.63 >diff -u -r1.63 PackageReferencePattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java 27 Jun 2008 16:04:00 -0000 1.63 >+++ search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java 18 Sep 2008 15:03:24 -0000 >@@ -28,11 +28,11 @@ > if (pkgName == null || pkgName.length == 0) { > this.pkgName = null; > this.segments = new char[][] {CharOperation.NO_CHAR}; >- ((InternalSearchPattern)this).mustResolve = false; >+ this.mustResolve = false; > } else { > this.pkgName = (this.isCaseSensitive || this.isCamelCase) ? pkgName : CharOperation.toLowerCase(pkgName); > this.segments = CharOperation.splitOn('.', this.pkgName); >- ((InternalSearchPattern)this).mustResolve = true; >+ this.mustResolve = true; > } > } > PackageReferencePattern(int matchRule) { >Index: search/org/eclipse/jdt/core/search/SearchPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java,v >retrieving revision 1.78 >diff -u -r1.78 SearchPattern.java >--- search/org/eclipse/jdt/core/search/SearchPattern.java 9 Sep 2008 15:39:07 -0000 1.78 >+++ search/org/eclipse/jdt/core/search/SearchPattern.java 18 Sep 2008 15:03:23 -0000 >@@ -10,13 +10,22 @@ > *******************************************************************************/ > package org.eclipse.jdt.core.search; > >+import java.io.IOException; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.OperationCanceledException; > import org.eclipse.jdt.core.*; > import org.eclipse.jdt.core.compiler.*; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; >+import org.eclipse.jdt.internal.compiler.env.AccessRuleSet; > import org.eclipse.jdt.internal.compiler.parser.Scanner; > import org.eclipse.jdt.internal.compiler.parser.ScannerHelper; > import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; > import org.eclipse.jdt.internal.core.LocalVariable; >+import org.eclipse.jdt.internal.core.index.EntryResult; >+import org.eclipse.jdt.internal.core.index.Index; >+import org.eclipse.jdt.internal.core.search.IndexQueryRequestor; >+import org.eclipse.jdt.internal.core.search.JavaSearchScope; > import org.eclipse.jdt.internal.core.search.indexing.IIndexConstants; > import org.eclipse.jdt.internal.core.search.matching.*; > >@@ -43,7 +52,7 @@ > * @see #createPattern(String, int, int, int) > * @since 3.0 > */ >-public abstract class SearchPattern extends InternalSearchPattern { >+public abstract class SearchPattern { > > // Rules for pattern matching: (exact, prefix, pattern) [ | case sensitive] > /** >@@ -197,6 +206,22 @@ > > private int matchRule; > >+ /** >+ * The focus element (used for reference patterns) >+ * @noreference This field is not intended to be referenced by clients. >+ */ >+ public IJavaElement focus; >+ >+ /** >+ * @noreference This field is not intended to be referenced by clients. >+ */ >+ public int kind; >+ >+ /** >+ * @noreference This field is not intended to be referenced by clients. >+ */ >+ public boolean mustResolve = true; >+ > /** > * Creates a search pattern with the rule to apply for matching index keys. > * It can be exact match, prefix match, pattern match or regexp match. >@@ -244,7 +269,43 @@ > this.matchRule &= ~R_PREFIX_MATCH; > } > } >+/** >+ * @noreference This method is not intended to be referenced by clients. >+ * @nooverride This method is not intended to be re-implemented or extended by clients. >+ */ >+public void acceptMatch(String relativePath, String containerPath, char separator, SearchPattern pattern, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope) { >+ >+ if (scope instanceof JavaSearchScope) { >+ JavaSearchScope javaSearchScope = (JavaSearchScope) scope; >+ // Get document path access restriction from java search scope >+ // Note that requestor has to verify if needed whether the document violates the access restriction or not >+ AccessRuleSet access = javaSearchScope.getAccessRuleSet(relativePath, containerPath); >+ if (access != JavaSearchScope.NOT_ENCLOSED) { // scope encloses the document path >+ StringBuffer documentPath = new StringBuffer(containerPath.length() + 1 + relativePath.length()); >+ documentPath.append(containerPath); >+ documentPath.append(separator); >+ documentPath.append(relativePath); >+ if (!requestor.acceptIndexMatch(documentPath.toString(), pattern, participant, access)) >+ throw new OperationCanceledException(); >+ } >+ } else { >+ StringBuffer buffer = new StringBuffer(containerPath.length() + 1 + relativePath.length()); >+ buffer.append(containerPath); >+ buffer.append(separator); >+ buffer.append(relativePath); >+ String documentPath = buffer.toString(); >+ if (scope.encloses(documentPath)) >+ if (!requestor.acceptIndexMatch(documentPath, pattern, participant, null)) >+ throw new OperationCanceledException(); > >+ } >+} >+/** >+ * @noreference This method is not intended to be referenced by clients. >+ */ >+public SearchPattern currentPattern() { >+ return this; >+} > /** > * Answers true if the pattern matches the given name using CamelCase rules, or > * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards >@@ -1991,6 +2052,39 @@ > // called from findIndexMatches(), override as necessary > } > /** >+ * Query a given index for matching entries. Assumes the sender has opened the index and will close when finished. >+ * >+ * @noreference This method is not intended to be referenced by clients. >+ * @nooverride This method is not intended to be re-implemented or extended by clients. >+ */ >+public void findIndexMatches(Index index, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope, IProgressMonitor monitor) throws IOException { >+ if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); >+ try { >+ index.startQuery(); >+ SearchPattern pattern = currentPattern(); >+ EntryResult[] entries = pattern.queryIn(index); >+ if (entries == null) return; >+ >+ SearchPattern decodedResult = pattern.getBlankPattern(); >+ String containerPath = index.containerPath; >+ char separator = index.separator; >+ for (int i = 0, l = entries.length; i < l; i++) { >+ if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); >+ >+ EntryResult entry = entries[i]; >+ decodedResult.decodeIndexKey(entry.getWord()); >+ if (pattern.matchesDecodedKey(decodedResult)) { >+ // TODO (kent) some clients may not need the document names >+ String[] names = entry.getDocumentNames(index); >+ for (int j = 0, n = names.length; j < n; j++) >+ acceptMatch(names[j], containerPath, separator, decodedResult, requestor, participant, scope); >+ } >+ } >+ } finally { >+ index.stopQuery(); >+ } >+} >+/** > * Returns a blank pattern that can be used as a record to decode an index key. > * <p> > * Implementors of this method should return a new search pattern that is going to be used >@@ -2044,6 +2138,12 @@ > return this.matchRule; > } > /** >+ * @noreference This method is not intended to be referenced by clients. >+ */ >+public boolean isPolymorphicSearch() { >+ return false; >+} >+/** > * Returns whether this pattern matches the given pattern (representing a decoded index key). > * <p> > * This method should be re-implemented in subclasses that need to narrow down the >@@ -2254,6 +2354,14 @@ > } > > /** >+ * @noreference This method is not intended to be referenced by clients. >+ * @nooverride This method is not intended to be re-implemented or extended by clients. >+ */ >+public EntryResult[] queryIn(Index index) throws IOException { >+ return index.query(getIndexCategories(), getIndexKey(), getMatchRule()); >+} >+ >+/** > * @see java.lang.Object#toString() > */ > public String toString() {
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 247835
:
112906
|
112909