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 153231 Details for
Bug 296277
[search] SearchEngine#searchAllTypeNames(.., TypeNameMatchRequestor,..) should report access rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 5.11 KB, created by
Frederic Fusier
on 2009-11-27 07:44:45 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2009-11-27 07:44:45 EST
Size:
5.11 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/core/search/TypeNameMatchRequestor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameMatchRequestor.java,v >retrieving revision 1.6 >diff -u -r1.6 TypeNameMatchRequestor.java >--- search/org/eclipse/jdt/core/search/TypeNameMatchRequestor.java 7 Mar 2009 01:08:10 -0000 1.6 >+++ search/org/eclipse/jdt/core/search/TypeNameMatchRequestor.java 27 Nov 2009 12:18:17 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.jdt.core.search; > >+import org.eclipse.jdt.core.IAccessRule; >+ > /** > * A <code>TypeNameMatchRequestor</code> collects matches from a <code>searchAllTypeNames</code> > * query to a <code>SearchEngine</code>. Clients must subclass this abstract class and pass an instance to the >@@ -38,11 +40,42 @@ > * @since 3.3 > */ > public abstract class TypeNameMatchRequestor { >- /** >- * Accepts a type name match ({@link TypeNameMatch}) which contains top-level or a member type >- * information as package name, enclosing types names, simple type name, modifiers, etc. >- * >- * @param match the match which contains all type information >- */ >- public abstract void acceptTypeNameMatch(TypeNameMatch match); >+ private int accessibility = IAccessRule.K_ACCESSIBLE; >+ >+/** >+ * Accepts a type name match ({@link TypeNameMatch}) which contains top-level or a member type >+ * information as package name, enclosing types names, simple type name, modifiers, etc. >+ * >+ * @param match the match which contains all type information >+ */ >+public abstract void acceptTypeNameMatch(TypeNameMatch match); >+ >+/** >+ * Returns the accessibility of the accepted match. >+ * >+ * @see IAccessRule >+ * >+ * @return the accessibility of the accepted type name which may be >+ * {@link IAccessRule#K_ACCESSIBLE}, {@link IAccessRule#K_DISCOURAGED} >+ * or {@link IAccessRule#K_NON_ACCESSIBLE}. >+ * The default returned value is {@link IAccessRule#K_ACCESSIBLE}. >+ * >+ * @since 3.6 >+ * @nooverride This method is not intended to be re-implemented or extended by clients. >+ */ >+public int getAccessibility() { >+ return this.accessibility; >+} >+ >+/** >+ * Sets the accessibility of the accepted match. >+ * >+ * @param accessibility the accessibility of the accepted type name 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 setAccessibility(int accessibility) { >+ this.accessibility = accessibility; >+} > } >Index: search/org/eclipse/jdt/internal/core/search/TypeNameMatchRequestorWrapper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/TypeNameMatchRequestorWrapper.java,v >retrieving revision 1.14 >diff -u -r1.14 TypeNameMatchRequestorWrapper.java >--- search/org/eclipse/jdt/internal/core/search/TypeNameMatchRequestorWrapper.java 22 Oct 2009 12:29:08 -0000 1.14 >+++ search/org/eclipse/jdt/internal/core/search/TypeNameMatchRequestorWrapper.java 27 Nov 2009 12:18:17 -0000 >@@ -12,6 +12,7 @@ > package org.eclipse.jdt.internal.core.search; > > import org.eclipse.core.runtime.Path; >+import org.eclipse.jdt.core.IAccessRule; > import org.eclipse.jdt.core.IClassFile; > import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jdt.core.IJavaElement; >@@ -20,6 +21,7 @@ > import org.eclipse.jdt.core.IType; > import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.core.compiler.CharOperation; >+import org.eclipse.jdt.core.compiler.IProblem; > import org.eclipse.jdt.core.search.IJavaSearchScope; > import org.eclipse.jdt.core.search.TypeNameMatchRequestor; > import org.eclipse.jdt.core.search.TypeNameRequestor; >@@ -80,6 +82,20 @@ > * @see org.eclipse.jdt.internal.core.search.IRestrictedAccessTypeRequestor#acceptType(int, char[], char[], char[][], java.lang.String, org.eclipse.jdt.internal.compiler.env.AccessRestriction) > */ > public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path, AccessRestriction access) { >+ >+ // Update requestor accessibility >+ if(access != null) { >+ switch (access.getProblemId()) { >+ case IProblem.ForbiddenReference: >+ this.requestor.setAccessibility(IAccessRule.K_NON_ACCESSIBLE); >+ break; >+ case IProblem.DiscouragedReference: >+ this.requestor.setAccessibility(IAccessRule.K_DISCOURAGED); >+ break; >+ } >+ } >+ >+ // Get type > try { > IType type = null; > if (this.handleFactory != null) { >@@ -108,6 +124,8 @@ > ? createTypeFromPath(path, new String(simpleTypeName), enclosingTypeNames) > : createTypeFromJar(path, separatorIndex); > } >+ >+ // Accept match if the type has been found > if (type != null) { > // hierarchy scopes require one more check: > if (!(this.scope instanceof HierarchyScope) || ((HierarchyScope)this.scope).enclosesFineGrained(type)) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
markus.kell.r
:
review-
Actions:
View
|
Diff
Attachments on
bug 296277
:
153231
|
153444
|
153806