diff options
author | Stephan Herrmann | 2020-04-11 12:28:09 +0000 |
---|---|---|
committer | Stephan Herrmann | 2020-04-11 12:28:09 +0000 |
commit | c4606e8c36137ec06dbe7f751e5a1b6fe3148e55 (patch) | |
tree | c4e3c0787b3b203dc4cd5446a35f0229a343bb5a /org.eclipse.jdt.core/search/org/eclipse/jdt | |
parent | bcd16035e3129a4b2ef22ffacae59d6a5ab65085 (diff) | |
download | org.eclipse.objectteams-c4606e8c36137ec06dbe7f751e5a1b6fe3148e55.tar.gz org.eclipse.objectteams-c4606e8c36137ec06dbe7f751e5a1b6fe3148e55.tar.xz org.eclipse.objectteams-c4606e8c36137ec06dbe7f751e5a1b6fe3148e55.zip |
Remove trailing whitespace on all lines
- manually replays JDT's 560451
Diffstat (limited to 'org.eclipse.jdt.core/search/org/eclipse/jdt')
142 files changed, 1245 insertions, 1245 deletions
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/JavaIndexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/JavaIndexer.java index 64351fabf..5d9f52fe0 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/JavaIndexer.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/JavaIndexer.java @@ -21,7 +21,7 @@ import org.eclipse.jdt.internal.core.search.indexing.DefaultJavaIndexer; /** * {@link JavaIndexer} provides functionality to generate index files which can be used by the JDT {@link SearchEngine}. * The generated index files can be used as a classpath attribute for the particular classpath entry. - * + * * <p> The search engine indexes all the elements referred in the classpath entries of the project into * index files. These index files are used to search the elements faster. Indexing for bigger jars could * take some time. To avoid this time, one can generate the index file and specify it when the jar is added diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/JavaIndexerApplication.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/JavaIndexerApplication.java index c552c3ceb..9b00a10e5 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/JavaIndexerApplication.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/JavaIndexerApplication.java @@ -7,7 +7,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -24,14 +24,14 @@ import org.eclipse.osgi.util.NLS; /** * Implements an Eclipse Application for {@link org.eclipse.jdt.core.index.JavaIndexer}. - * + * * <p> * On MacOS, when invoked using the Eclipse executable, the "user.dir" property is set to the folder in which the * eclipse.ini file is located. This makes it harder to use relative paths to point to the files to be jar'd or to * the index file that is generated. * </p> - * - * + * + * * @since 3.8 * @noinstantiate This class is not intended to be instantiated by clients. * @noextend This class is not intended to be subclassed by clients. diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldDeclarationMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldDeclarationMatch.java index 9da6ad7d4..4443a5b4a 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldDeclarationMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldDeclarationMatch.java @@ -22,14 +22,14 @@ import org.eclipse.jdt.core.IJavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.0 */ public class FieldDeclarationMatch extends SearchMatch { /** * Creates a new field declaration match. - * + * * @param element the field declaration * @param accuracy one of A_ACCURATE or A_INACCURATE * @param offset the offset the match starts at, or -1 if unknown diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldReferenceMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldReferenceMatch.java index 022820b29..de864bcdb 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldReferenceMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldReferenceMatch.java @@ -22,7 +22,7 @@ import org.eclipse.jdt.core.IJavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.0 */ public class FieldReferenceMatch extends ReferenceMatch { @@ -32,7 +32,7 @@ private boolean isWriteAccess; /** * Creates a new field reference match. - * + * * @param enclosingElement the inner-most enclosing member that references * this field * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} @@ -54,7 +54,7 @@ public FieldReferenceMatch(IJavaElement enclosingElement, int accuracy, int offs /** * Returns whether the field reference is a read access to the field. * Note that a field reference can be read and written at once in case of compound assignments (e.g. i += 0;) - * + * * @return whether the field reference is a read access to the field. */ public final boolean isReadAccess() { @@ -64,7 +64,7 @@ public final boolean isReadAccess() { /** * Returns whether the field reference is a write access to the field. * Note that a field reference can be read and written at once in case of compound assignments (e.g. i += 0;) - * + * * @return whether the field reference is a write access to the field. */ public final boolean isWriteAccess() { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java index d7c0f9260..d7933b874 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java @@ -33,49 +33,49 @@ public interface IJavaSearchConstants { * of match in unknown. */ int UNKNOWN = -1; - + /* Nature of searched element */ - + /** * The searched element is a type, which may include classes, interfaces, * enums, and annotation types. - * + * * @category searchFor */ int TYPE= 0; /** * The searched element is a method. - * + * * @category searchFor */ int METHOD= 1; /** * The searched element is a package. - * + * * @category searchFor */ int PACKAGE= 2; /** * The searched element is a constructor. - * + * * @category searchFor */ int CONSTRUCTOR= 3; /** * The searched element is a field. - * + * * @category searchFor */ int FIELD= 4; /** - * The searched element is a class. + * The searched element is a class. * More selective than using {@link #TYPE}. - * + * * @category searchFor */ int CLASS= 5; @@ -83,7 +83,7 @@ public interface IJavaSearchConstants { /** * The searched element is an interface. * More selective than using {@link #TYPE}. - * + * * @category searchFor */ int INTERFACE= 6; @@ -91,7 +91,7 @@ public interface IJavaSearchConstants { /** * The searched element is an enum. * More selective than using {@link #TYPE}. - * + * * @since 3.1 * @category searchFor */ @@ -100,7 +100,7 @@ public interface IJavaSearchConstants { /** * The searched element is an annotation type. * More selective than using {@link #TYPE}. - * + * * @since 3.1 * @category searchFor */ @@ -109,7 +109,7 @@ public interface IJavaSearchConstants { /** * The searched element is a class or enum type. * More selective than using {@link #TYPE}. - * + * * @since 3.1 * @category searchFor */ @@ -118,12 +118,12 @@ public interface IJavaSearchConstants { /** * The searched element is a class or interface type. * More selective than using {@link #TYPE}. - * + * * @since 3.1 * @category searchFor */ int CLASS_AND_INTERFACE= 10; - + /** * The searched element is an interface or annotation type. * More selective than using {@link #TYPE}. @@ -144,18 +144,18 @@ public interface IJavaSearchConstants { * The search result is a declaration. * Can be used in conjunction with any of the nature of searched elements * so as to better narrow down the search. - * + * * @category limitTo */ int DECLARATIONS= 0; /** - * The search result is a type that implements an interface or extends a class. + * The search result is a type that implements an interface or extends a class. * Used in conjunction with either TYPE or CLASS or INTERFACE, it will * respectively search for any type implementing/extending a type, * or rather exclusively search for classes implementing/extending the type, or * interfaces extending the type. - * + * * @category limitTo */ int IMPLEMENTORS= 1; @@ -166,17 +166,17 @@ public interface IJavaSearchConstants { * so as to better narrow down the search. * References can contain implementers since they are more generic kind * of matches. - * + * * @category limitTo */ int REFERENCES= 2; /** - * The search result is a declaration, a reference, or an implementer + * The search result is a declaration, a reference, or an implementer * of an interface. * Can be used in conjunction with any of the nature of searched elements * so as to better narrow down the search. - * + * * @category limitTo */ int ALL_OCCURRENCES= 3; @@ -185,17 +185,17 @@ public interface IJavaSearchConstants { * When searching for field matches, it will exclusively find read accesses, as * opposed to write accesses. Note that some expressions are considered both * as field read/write accesses: for example, x++; x+= 1; - * + * * @since 2.0 * @category limitTo */ int READ_ACCESSES = 4; - + /** * When searching for field matches, it will exclusively find write accesses, as * opposed to read accesses. Note that some expressions are considered both * as field read/write accesses: for example, x++; x+= 1; - * + * * @since 2.0 * @category limitTo */ @@ -210,7 +210,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int MODULE_GRAPH = 6; - + //{ObjectTeams: search for playedBy references only: /** * When searching for type references, it will exclusively find references @@ -224,7 +224,7 @@ public interface IJavaSearchConstants { /** * Ignore declaring type while searching result. * Can be used in conjunction with any of the nature of match. - * + * * @since 3.1 * @category limitTo */ @@ -243,7 +243,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int IGNORE_RETURN_TYPE = 0x20; - + /** * Return only type references used as the type of a field declaration. * <p> @@ -254,7 +254,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int FIELD_DECLARATION_TYPE_REFERENCE = 0x40; - + /** * Return only type references used as the type of a local variable declaration. * <p> @@ -265,7 +265,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE = 0x80; - + /** * Return only type references used as the type of a method parameter * declaration. @@ -277,7 +277,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int PARAMETER_DECLARATION_TYPE_REFERENCE = 0x100; - + /** * Return only type references used as a super type or as a super interface. * <p> @@ -288,7 +288,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int SUPERTYPE_TYPE_REFERENCE = 0x200; - + /** * Return only type references used in a throws clause. * <p> @@ -299,7 +299,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int THROWS_CLAUSE_TYPE_REFERENCE = 0x400; - + /** * Return only type references used in a cast expression. * <p> @@ -310,7 +310,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int CAST_TYPE_REFERENCE = 0x800; - + /** * Return only type references used in a catch header. * <p> @@ -321,7 +321,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int CATCH_TYPE_REFERENCE = 0x1000; - + /** * Return only type references used in class instance creation. * <p> @@ -346,7 +346,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int CLASS_INSTANCE_CREATION_TYPE_REFERENCE = 0x2000; - + /** * Return only type references used as a method return type. * <p> @@ -357,7 +357,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int RETURN_TYPE_REFERENCE = 0x4000; - + /** * Return only type references used in an import declaration. * <p> @@ -425,7 +425,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int INSTANCEOF_TYPE_REFERENCE = 0x100000; - + /** * Return only super field accesses or super method invocations (e.g. using the * <code>super</code> qualifier). @@ -442,7 +442,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int SUPER_REFERENCE = 0x1000000; - + /** * Return only qualified field accesses or qualified method invocations. * <p> @@ -458,7 +458,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int QUALIFIED_REFERENCE = 0x2000000; - + /** * Return only primary field accesses or primary method invocations (e.g. using * the <code>this</code> qualifier). @@ -475,7 +475,7 @@ public interface IJavaSearchConstants { * @category limitTo */ int THIS_REFERENCE = 0x4000000; - + /** * Return only field accesses or method invocations without any qualification. * <p> @@ -504,26 +504,26 @@ public interface IJavaSearchConstants { int METHOD_REFERENCE_EXPRESSION = 0x10000000; /* Syntactic match modes */ - + /** * The search pattern matches exactly the search result, * that is, the source of the search result equals the search pattern. - * + * * @deprecated Use {@link SearchPattern#R_EXACT_MATCH} instead. * @category matchRule */ int EXACT_MATCH = 0; /** * The search pattern is a prefix of the search result. - * + * * @deprecated Use {@link SearchPattern#R_PREFIX_MATCH} instead. * @category matchRule */ int PREFIX_MATCH = 1; /** - * The search pattern contains one or more wild cards ('*') where a + * The search pattern contains one or more wild cards ('*') where a * wild-card can replace 0 or more characters in the search result. - * + * * @deprecated Use {@link SearchPattern#R_PATTERN_MATCH} instead. * @category matchRule */ @@ -531,11 +531,11 @@ public interface IJavaSearchConstants { /* Case sensitivity */ - + /** * The search pattern matches the search result only * if cases are the same. - * + * * @deprecated Use the methods that take the matchMode * with {@link SearchPattern#R_CASE_SENSITIVE} as a matchRule instead. * @category matchRule @@ -543,16 +543,16 @@ public interface IJavaSearchConstants { boolean CASE_SENSITIVE = true; /** * The search pattern ignores cases in the search result. - * + * * @deprecated Use the methods that take the matchMode * without {@link SearchPattern#R_CASE_SENSITIVE} as a matchRule instead. * @category matchRule */ boolean CASE_INSENSITIVE = false; - + /* Waiting policies */ - + /** * The search operation starts immediately, even if the underlying indexer * has not finished indexing the workspace. Results will more likely @@ -565,7 +565,7 @@ public interface IJavaSearchConstants { */ int CANCEL_IF_NOT_READY_TO_SEARCH = IJob.CancelIfNotReady; /** - * The search operation waits for the underlying indexer to finish indexing + * The search operation waits for the underlying indexer to finish indexing * the workspace before starting the search. */ int WAIT_UNTIL_READY_TO_SEARCH = IJob.WaitUntilReady; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchResultCollector.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchResultCollector.java index 640b24a96..e4c766081 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchResultCollector.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchResultCollector.java @@ -31,10 +31,10 @@ import org.eclipse.jdt.core.IJavaElement; * case can occur when a problem prevented the <code>SearchEngine</code> from resolving the match. * </p> * <p> - * The order of the results is unspecified. Clients must not rely on this order to display results, + * The order of the results is unspecified. Clients must not rely on this order to display results, * but they should sort these results (for example, in syntactical order). * <p> - * The <code>IJavaSearchResultCollector</code> is also used to provide a progress monitor to the + * The <code>IJavaSearchResultCollector</code> is also used to provide a progress monitor to the * <code>SearchEngine</code>. * </p> * <p> @@ -48,7 +48,7 @@ import org.eclipse.jdt.core.IJavaElement; public interface IJavaSearchResultCollector { /** * The search result corresponds exactly to the search pattern. - * + * * @deprecated Use {@link SearchMatch#A_ACCURATE} instead. */ int EXACT_MATCH = 0; @@ -57,14 +57,14 @@ public interface IJavaSearchResultCollector { * The search result is potentially a match for the search pattern, * but a problem prevented the search engine from being more accurate * (typically because of the classpath was not correctly set). - * + * * @deprecated Use {@link SearchMatch#A_INACCURATE} instead. */ int POTENTIAL_MATCH = 1; /** * Called before the actual search starts. - * + * * @deprecated Replaced by {@link SearchRequestor#beginReporting()}. */ public void aboutToStart(); @@ -74,7 +74,7 @@ public void aboutToStart(); * @param resource the resource in which the match has been found * @param start the start position of the match, -1 if it is unknown * @param end the end position of the match, -1 if it is unknown; - * the ending offset is exclusive, meaning that the actual range of characters + * the ending offset is exclusive, meaning that the actual range of characters * covered is <code>[start, end]</code> * @param enclosingElement the Java element that contains the character range * <code>[start, end]</code>; the value can be <code>null</code> indicating that @@ -93,7 +93,7 @@ public void accept( throws CoreException; /** * Called when the search has ended. - * + * * @deprecated Replaced by {@link SearchRequestor#endReporting()}. */ public void done(); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchScope.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchScope.java index 212b552c0..5e0b9334d 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchScope.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchScope.java @@ -57,9 +57,9 @@ int REFERENCED_PROJECTS = 8; * * @param resourcePath if the resource is contained in * a JAR file, the path is composed of 2 paths separated - * by <code>JAR_FILE_ENTRY_SEPARATOR</code>: the first path is the full OS path + * by <code>JAR_FILE_ENTRY_SEPARATOR</code>: the first path is the full OS path * to the JAR (if it is an external JAR), or the workspace relative <code>IPath</code> - * to the JAR (if it is an internal JAR), + * to the JAR (if it is an internal JAR), * the second path is the path to the resource inside the JAR. * @return whether the resource is enclosed by this scope */ @@ -87,14 +87,14 @@ public boolean encloses(IJavaElement element); * For example, d:\libs\mylib.jar * </li> * </ul> - * + * * @return an array of paths to the enclosing projects and JARS. */ IPath[] enclosingProjectsAndJars(); /** * Returns whether this scope contains any <code>.class</code> files (either * in folders or within JARs). - * + * * @return whether this scope contains any <code>.class</code> files * @deprecated Use * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])} @@ -102,9 +102,9 @@ IPath[] enclosingProjectsAndJars(); */ boolean includesBinaries(); /** - * Returns whether this scope includes classpaths defined by + * Returns whether this scope includes classpaths defined by * the projects of the resources of this search scope. - * + * * @return whether this scope includes classpaths * @deprecated Use * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])} @@ -114,7 +114,7 @@ boolean includesClasspaths(); /** * Sets whether this scope contains any <code>.class</code> files (either * in folders or within JARs). - * + * * @param includesBinaries whether this scope contains any <code>.class</code> files * @deprecated Use * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])} @@ -122,9 +122,9 @@ boolean includesClasspaths(); */ public void setIncludesBinaries(boolean includesBinaries); /** - * Sets whether this scope includes the classpaths defined by + * Sets whether this scope includes the classpaths defined by * the projects of the resources of this search scope. - * + * * @param includesClasspaths whether this scope includes classpaths * @deprecated Use * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])} diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ITypeNameRequestor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ITypeNameRequestor.java index a2ebba8df..e160d3484 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ITypeNameRequestor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ITypeNameRequestor.java @@ -29,7 +29,7 @@ public interface ITypeNameRequestor { * * @param packageName the dot-separated name of the package of the class * @param simpleTypeName the simple name of the class - * @param enclosingTypeNames if the class is a member type, + * @param enclosingTypeNames if the class is a member type, * the simple names of the enclosing types from the outer-most to the * direct parent of the class (for example, if the class is x.y.A$B$C then * the enclosing types are [A, B]. This is an empty array if the class @@ -37,9 +37,9 @@ public interface ITypeNameRequestor { * @param path the full path to the resource containing the class. If the resource is a .class file * or a source file, this is the full path in the workspace to this resource. If the * resource is an archive (that is, a .zip or .jar file), the path is composed of 2 paths separated - * by <code>IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR</code>: - * the first path is the full OS path to the archive (if it is an external archive), - * or the workspace relative <code>IPath</code> to the archive (if it is an internal archive), + * by <code>IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR</code>: + * the first path is the full OS path to the archive (if it is an external archive), + * or the workspace relative <code>IPath</code> to the archive (if it is an internal archive), * the second path is the path to the resource inside the archive. */ void acceptClass(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path); @@ -48,7 +48,7 @@ void acceptClass(char[] packageName, char[] simpleTypeName, char[][] enclosingTy * * @param packageName the dot-separated name of the package of the interface * @param simpleTypeName the simple name of the interface - * @param enclosingTypeNames if the interface is a member type, + * @param enclosingTypeNames if the interface is a member type, * the simple names of the enclosing types from the outer-most to the * direct parent of the interface (for example, if the interface is x.y.A$B$I then * the enclosing types are [A, B]. This is an empty array if the interface @@ -56,9 +56,9 @@ void acceptClass(char[] packageName, char[] simpleTypeName, char[][] enclosingTy * @param path the full path to the resource containing the interface. If the resource is a .class file * or a source file, this is the full path in the workspace to this resource. If the * resource is an archive (that is, a .zip or .jar file), the path is composed of 2 paths separated - * by <code>IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR</code>: - * the first path is the full OS path to the archive (if it is an external archive), - * or the workspace relative <code>IPath</code> to the archive (if it is an internal archive), + * by <code>IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR</code>: + * the first path is the full OS path to the archive (if it is an external archive), + * or the workspace relative <code>IPath</code> to the archive (if it is an internal archive), * the second path is the path to the resource inside the archive. * */ void acceptInterface(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/LocalVariableDeclarationMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/LocalVariableDeclarationMatch.java index 251aa8609..868f8c3d6 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/LocalVariableDeclarationMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/LocalVariableDeclarationMatch.java @@ -22,14 +22,14 @@ import org.eclipse.jdt.core.IJavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.0 */ public class LocalVariableDeclarationMatch extends SearchMatch { /** * Creates a new local variable declaration match. - * + * * @param element the local variable declaration * @param accuracy one of A_ACCURATE or A_INACCURATE * @param offset the offset the match starts at, or -1 if unknown diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/LocalVariableReferenceMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/LocalVariableReferenceMatch.java index dcf6820df..e73554c94 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/LocalVariableReferenceMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/LocalVariableReferenceMatch.java @@ -22,7 +22,7 @@ import org.eclipse.jdt.core.IJavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.0 */ public class LocalVariableReferenceMatch extends SearchMatch { @@ -32,7 +32,7 @@ public class LocalVariableReferenceMatch extends SearchMatch { /** * Creates a new local variable reference match. - * + * * @param enclosingElement the inner-most enclosing member that references this local variable * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} * @param offset the offset the match starts at, or -1 if unknown @@ -54,7 +54,7 @@ public class LocalVariableReferenceMatch extends SearchMatch { /** * Returns whether the local variable reference is a read access to the variable. * Note that a local variable reference can be read and written at once in case of compound assignments (e.g. i += 0;) - * + * * @return whether the local variable reference is a read access to the variable. */ public final boolean isReadAccess() { @@ -64,7 +64,7 @@ public class LocalVariableReferenceMatch extends SearchMatch { /** * Returns whether the local variable reference is a write access to the variable. * Note that a local variable reference can be read and written at once in case of compound assignments (e.g. i += 0;) - * + * * @return whether the local variable reference is a write access to the variable. */ public final boolean isWriteAccess() { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodDeclarationMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodDeclarationMatch.java index 587dbfc7a..45a747df0 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodDeclarationMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodDeclarationMatch.java @@ -22,14 +22,14 @@ import org.eclipse.jdt.core.IJavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.0 */ public class MethodDeclarationMatch extends SearchMatch { /** * Creates a new method declaration match. - * + * * @param element the method declaration * @param accuracy one of A_ACCURATE or A_INACCURATE * @param offset the offset the match starts at, or -1 if unknown diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodNameRequestor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodNameRequestor.java index 27e9b712d..1be01eba5 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodNameRequestor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodNameRequestor.java @@ -14,27 +14,27 @@ package org.eclipse.jdt.core.search; /** - * + * * A <code> MethodDeclarationRequestor</code> collects search results from a <code> searchAllMethodDeclarations</code> * query to a <code>SearchEngine</code>. Clients must subclass this abstract class and pass an instance to the - * <code>SearchEngine.searchAllMethodDeclarations</code> method. - * + * <code>SearchEngine.searchAllMethodDeclarations</code> method. + * * <p> * This class may be subclassed by clients * </p> * @since 3.12 - * + * */ public abstract class MethodNameRequestor { - + /** * Accepts a method. - * + * * <p> - * The default implementation of this method does nothing. + * The default implementation of this method does nothing. * Subclasses should override. * </p> - * + * * @param methodName name of the method. * @param parameterCount number of parameters in this method. * @param declaringQualifier the qualified name of parent of the enclosing type of this method. diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java index 4ea6923cc..4e11a3fa9 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java @@ -22,7 +22,7 @@ import org.eclipse.jdt.core.IJavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.0 */ public class MethodReferenceMatch extends ReferenceMatch { @@ -32,7 +32,7 @@ public class MethodReferenceMatch extends ReferenceMatch { /** * 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 @@ -48,7 +48,7 @@ public MethodReferenceMatch(IJavaElement enclosingElement, int accuracy, int off /** * 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 @@ -71,7 +71,7 @@ public MethodReferenceMatch(IJavaElement enclosingElement, int accuracy, int off /** * 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 @@ -107,7 +107,7 @@ public final boolean isConstructor() { * Returns whether the reference is on a synthetic element. * Note that this field is only used for constructor reference. This happens when default constructor * declaration is used or implicit super constructor is called. - * + * * @return whether the reference is synthetic or not. * @since 3.1 */ @@ -120,7 +120,7 @@ public final boolean isSynthetic() { * which is a super type of the searched method declaring type. * If <code>true</code>, the method called at run-time may or may not be * the search target, depending on the run-time type of the receiver object. - * + * * @return <code>true</code> if the reference is on a message sent from * a super-type of the searched method declaring class, <code>false</code> otherwise * @since 3.3 diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ModuleReferenceMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ModuleReferenceMatch.java index 1e99e6a85..e88a6a82d 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ModuleReferenceMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ModuleReferenceMatch.java @@ -7,7 +7,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageDeclarationMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageDeclarationMatch.java index 8886fa241..7f1000256 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageDeclarationMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageDeclarationMatch.java @@ -22,14 +22,14 @@ import org.eclipse.jdt.core.IJavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.0 */ public class PackageDeclarationMatch extends SearchMatch { /** * Creates a new package declaration match. - * + * * @param element the package declaration * @param accuracy one of A_ACCURATE or A_INACCURATE * @param offset the offset the match starts at, or -1 if unknown diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageReferenceMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageReferenceMatch.java index 79623c89e..471af46ec 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageReferenceMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageReferenceMatch.java @@ -22,14 +22,14 @@ import org.eclipse.jdt.core.IJavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.0 */ public class PackageReferenceMatch extends ReferenceMatch { /** * Creates a new package reference match. - * + * * @param enclosingElement the inner-most enclosing member that references this package * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} * @param offset the offset the match starts at, or -1 if unknown diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ReferenceMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ReferenceMatch.java index 951eba95f..afefd39eb 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ReferenceMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ReferenceMatch.java @@ -18,7 +18,7 @@ import org.eclipse.jdt.core.*; /** * An abstract Java search match that represents a reference. - * + * * @since 3.4 */ public abstract class ReferenceMatch extends SearchMatch { @@ -27,7 +27,7 @@ public abstract class ReferenceMatch extends SearchMatch { /** * Creates a new reference match. - * + * * @param enclosingElement the inner-most enclosing member that references this java element * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} * @param offset the offset the match starts at, or -1 if unknown @@ -45,10 +45,10 @@ public ReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, i /** * Returns the local element of this search match, or <code>null</code> if none. * A local element is the inner-most element that contains the reference and that is - * not reachable by navigating from the root of the {@link IJavaModel} using + * not reachable by navigating from the root of the {@link IJavaModel} using * {@link IParent#getChildren()}. * <p> - * Known element types for local elements are {@link IJavaElement#ANNOTATION}, + * Known element types for local elements are {@link IJavaElement#ANNOTATION}, * {@link IJavaElement#LOCAL_VARIABLE} and {@link IJavaElement#TYPE_PARAMETER}.<br> * However clients should not assume that this set of element types is closed as * other types of elements may be returned in the future, e.g. if new types @@ -105,14 +105,14 @@ public ReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, i * Or a local element may be an {@link ITypeParameter} that extends the referenced * type. For example, * <ul> - * <li>searching for the references to the type <code>Test</code> in + * <li>searching for the references to the type <code>Test</code> in * <pre> * public class X< T extends Test> { * }</pre> * will return one {@link TypeReferenceMatch} match whose local element * is the {@link ITypeParameter} '<code>T</code>'.<br><br> * </ul> - * + * * @return the local element of this search match, or <code>null</code> if none. * * @since 3.4 @@ -125,7 +125,7 @@ final public IJavaElement getLocalElement() { * Store the local element in the match. * * @param element The local element to be stored - * + * * @since 3.5 */ final public void setLocalElement(IJavaElement element) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchDocument.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchDocument.java index a3796e0e1..730db1546 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchDocument.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchDocument.java @@ -22,7 +22,7 @@ import org.eclipse.jdt.internal.core.index.Index; * <p> * This class is intended to be subclassed by clients. * </p> - * + * * @since 3.0 */ public abstract class SearchDocument { @@ -32,11 +32,11 @@ public abstract class SearchDocument { private String documentPath; private SearchParticipant participant; private boolean shouldIndexResolvedDocument = false; - + /** * Creates a new search document. The given document path is a string that uniquely identifies the document. * Most of the time it is a workspace-relative path, but it can also be a file system path, or a path inside a zip file. - * + * * @param documentPath the path to the document, * or <code>null</code> if none * @param participant the participant that creates the search document @@ -50,7 +50,7 @@ public abstract class SearchDocument { * Adds the given index entry (category and key) coming from this * document to the index. This method must be called from * {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath)}. - * + * * @param category the category of the index entry * @param key the key of the index entry */ @@ -58,7 +58,7 @@ public abstract class SearchDocument { if (this.index != null) this.index.addIndexEntry(category, key, getContainerRelativePath()); } - + /** * Returns the contents of this document. * Contents may be different from actual resource at corresponding document path, @@ -69,10 +69,10 @@ public abstract class SearchDocument { * Note: some implementation may choose to cache the contents directly on the * document for performance reason. However, this could induce scalability issues due * to the fact that collections of documents are manipulated throughout the search - * operation, and cached contents would then consume lots of memory until they are + * operation, and cached contents would then consume lots of memory until they are * all released at once in the end. * </p> - * + * * @return the contents of this document, * or <code>null</code> if none */ @@ -88,10 +88,10 @@ public abstract class SearchDocument { * Note: some implementation may choose to cache the contents directly on the * document for performance reason. However, this could induce scalability issues due * to the fact that collections of documents are manipulated throughout the search - * operation, and cached contents would then consume lots of memory until they are + * operation, and cached contents would then consume lots of memory until they are * all released at once in the end. * </p> - * + * * @return the contents of this document, * or <code>null</code> if none */ @@ -108,7 +108,7 @@ public abstract class SearchDocument { * <p> * This method must be implemented in subclasses. * </p> - * + * * @return the encoding for this document, * or <code>null</code> if none */ @@ -121,37 +121,37 @@ public abstract class SearchDocument { public SourceElementParser getParser() { return this.parser; } - + /** * Returns the participant that created this document. - * + * * @return the participant that created this document */ public final SearchParticipant getParticipant() { return this.participant; } - + /** * Returns the path to the original document to publicly mention in index * or search results. This path is a string that uniquely identifies the document. - * Most of the time it is a workspace-relative path, but it can also be a file system path, + * Most of the time it is a workspace-relative path, but it can also be a file system path, * or a path inside a zip file. - * + * * @return the path to the document - */ + */ public final String getPath() { return this.documentPath; } /** * Removes all index entries from the index for the given document. - * This method must be called from + * This method must be called from * {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath)}. */ public void removeAllIndexEntries() { if (this.index != null) this.index.remove(getContainerRelativePath()); } - + /** * @nooverride This method is not intended to be re-implemented or extended by clients. * @noreference This method is not intended to be referenced by clients. @@ -159,7 +159,7 @@ public abstract class SearchDocument { public void setIndex(Index indexToSet) { this.index = indexToSet; } - + /** * @nooverride This method is not intended to be re-implemented or extended by clients. * @noreference This method is not intended to be referenced by clients. @@ -168,16 +168,16 @@ public abstract class SearchDocument { this.parser = sourceElementParser; } - /** Flags the document as requiring indexing after symbol and type resolution. A participant would be asked - * to resolve the document via {@link SearchParticipant#resolveDocument} and to index the document adding - * additional entries via {@link SearchParticipant#indexResolvedDocument} - * - * @since 3.10 + /** Flags the document as requiring indexing after symbol and type resolution. A participant would be asked + * to resolve the document via {@link SearchParticipant#resolveDocument} and to index the document adding + * additional entries via {@link SearchParticipant#indexResolvedDocument} + * + * @since 3.10 */ public void requireIndexingResolvedDocument() { this.shouldIndexResolvedDocument = true; } - + /** * @nooverride This method is not intended to be re-implemented or extended by clients. * @noreference This method is not intended to be referenced by clients. diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java index 19d37e3bd..e845aeb66 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java @@ -206,16 +206,16 @@ public class SearchEngine { * <p> * By default, hierarchy scopes include all direct and indirect supertypes and subtypes of the * focus type. This method, however, allows to restrict the hierarchy to true subtypes, - * and exclude supertypes. Also, inclusion of the focus type itself is controlled by a parameter. + * and exclude supertypes. Also, inclusion of the focus type itself is controlled by a parameter. * </p> - * + * * @param project the project to which to constrain the search, or <code>null</code> if - * search should consider all types in the workspace + * search should consider all types in the workspace * @param type the focus of the hierarchy scope * @param onlySubtypes if <code>true</code> only subtypes of <code>type</code> are considered - * @param includeFocusType if true the focus type <code>type</code> is included in the resulting scope, + * @param includeFocusType if true the focus type <code>type</code> is included in the resulting scope, * otherwise it is excluded - * @param owner the owner of working copies that take precedence over original compilation units, + * @param owner the owner of working copies that take precedence over original compilation units, * or <code>null</code> if the primary working copy owner should be used * @return a new hierarchy scope * @exception JavaModelException if the hierarchy could not be computed on the given type @@ -507,8 +507,8 @@ public class SearchEngine { /** * Create a method name match on a given method with specific modifiers. * <p> - * NOTE: this is a first-cut version and might have noticeable delay times in some cases. - * Targeted for optimization during 4.7. It is recommended to contact JDT Team if + * NOTE: this is a first-cut version and might have noticeable delay times in some cases. + * Targeted for optimization during 4.7. It is recommended to contact JDT Team if * anyone plans to use this. * </p> * @param method The Java model handle of the method @@ -674,11 +674,11 @@ public class SearchEngine { * Searches for all method declarations in the given scope. Accepted matches will be returned by * {@link MethodNameRequestor#acceptMethod}. * <p> - * NOTE: this is a first-cut version and might have noticeable delay times in some cases. - * Targeted for optimization during 4.7. It is recommended to contact JDT Team if + * NOTE: this is a first-cut version and might have noticeable delay times in some cases. + * Targeted for optimization during 4.7. It is recommended to contact JDT Team if * anyone plans to use this. * </p> - * + * * @param packageName the full name of the package of the searched types, or a prefix for this * package, or a wild-carded string for this package. * May be <code>null</code>, then any package name is accepted. @@ -702,7 +702,7 @@ public class SearchEngine { * @param progressMonitor the progress monitor to report progress to, or <code>null</code> if no progress * monitor is provided * @exception JavaModelException if the search failed. - * + * * @since 3.12 */ public void searchAllMethodNames( @@ -720,27 +720,27 @@ public class SearchEngine { IProgressMonitor progressMonitor) throws JavaModelException { MethodNameRequestorWrapper requestorWrapper = new MethodNameRequestorWrapper(nameRequestor); this.basicEngine.searchAllMethodNames( - packageName, pkgMatchRule, - declaringQualification, declQualificationMatchRule, - declaringSimpleName, declSimpleNameMatchRule, - methodName, methodMatchRule, - scope, requestorWrapper, + packageName, pkgMatchRule, + declaringQualification, declQualificationMatchRule, + declaringSimpleName, declSimpleNameMatchRule, + methodName, methodMatchRule, + scope, requestorWrapper, waitingPolicy, progressMonitor); } /** - * Searches for all method declarations in the given scope. + * Searches for all method declarations in the given scope. * <p> * Provided {@link MethodNameMatchRequestor} requestor will collect the {@link MethodNameMatch} * matches found during the search. * </p> * <p> - * NOTE: this is a first-cut version and might have noticeable delay times in some cases. - * Targeted for optimization during 4.7. It is recommended to contact JDT Team if + * NOTE: this is a first-cut version and might have noticeable delay times in some cases. + * Targeted for optimization during 4.7. It is recommended to contact JDT Team if * anyone plans to use this. * </p> - * + * * @param packageName the full name of the package of the searched types, or a prefix for this * package, or a wild-carded string for this package. * May be <code>null</code>, then any package name is accepted. @@ -764,7 +764,7 @@ public class SearchEngine { * @param progressMonitor the progress monitor to report progress to, or <code>null</code> if no progress * monitor is provided * @exception JavaModelException if the search failed. - * + * * @since 3.12 */ public void searchAllMethodNames( @@ -786,7 +786,7 @@ public class SearchEngine { declaringQualification, declQualificationMatchRule, declaringSimpleName, declSimpleNameMatchRule, methodName, methodMatchRule, - scope, requestorWrapper, + scope, requestorWrapper, waitingPolicy, progressMonitor); } @@ -794,11 +794,11 @@ public class SearchEngine { * Searches for all method declarations in the given scope. Accepted matches will be returned by * {@link MethodNameRequestor#acceptMethod}. * <p> - * NOTE: this is a first-cut version and might have noticeable delay times in some cases. - * Targeted for optimization during 4.7. It is recommended to contact JDT Team if + * NOTE: this is a first-cut version and might have noticeable delay times in some cases. + * Targeted for optimization during 4.7. It is recommended to contact JDT Team if * anyone plans to use this. * </p> - * + * * @param qualifier qualifier including package name and qualified type name * May be <code>null</code>, then any qualifier name is accepted. * @param qualifierMatchRule match rule for the qualifier and can be one of @@ -812,7 +812,7 @@ public class SearchEngine { * <li>{@link SearchPattern#R_CAMELCASE_MATCH} if the package name and types are * camel case of the package and type of searched methods.</li> * <li>{@link SearchPattern#R_CAMELCASE_SAME_PART_COUNT_MATCH} - * if the package name and type names are camel case with same part count of the + * if the package name and type names are camel case with same part count of the * package and types of searched methods.</li> * </ul> * @param methodName the method name searched for. @@ -822,7 +822,7 @@ public class SearchEngine { * is exact.</li> * <li>{@link SearchPattern#R_PREFIX_MATCH} if method * name is prefix of the names of the searched methods.</li> - * <li>{@link SearchPattern#R_PATTERN_MATCH} if the method name + * <li>{@link SearchPattern#R_PATTERN_MATCH} if the method name * contains wild-cards.</li> * <li>{@link SearchPattern#R_CAMELCASE_MATCH} if the method name is a * camel case of the searched method name.</li> @@ -843,7 +843,7 @@ public class SearchEngine { * @param progressMonitor the progress monitor to report progress to, or <code>null</code> if no progress * monitor is provided * @exception JavaModelException if the search failed. - * + * * @since 3.12 */ public void searchAllMethodNames( @@ -857,24 +857,24 @@ public class SearchEngine { IProgressMonitor progressMonitor) throws JavaModelException { MethodNameRequestorWrapper requestorWrapper = new MethodNameRequestorWrapper(nameRequestor); this.basicEngine.searchAllMethodNames( - qualifier, qualifierMatchRule, - methodName, methodMatchRule, - scope, requestorWrapper, + qualifier, qualifierMatchRule, + methodName, methodMatchRule, + scope, requestorWrapper, waitingPolicy, progressMonitor); } /** - * Searches for all method declarations in the given scope. + * Searches for all method declarations in the given scope. * <p> * Provided {@link MethodNameMatchRequestor} requestor will collect the {@link MethodNameMatch} * matches found during the search. * </p> * <p> - * NOTE: this is a first-cut version and might have noticeable delay times in some cases. - * Targeted for optimization during 4.7. It is recommended to contact JDT Team if + * NOTE: this is a first-cut version and might have noticeable delay times in some cases. + * Targeted for optimization during 4.7. It is recommended to contact JDT Team if * anyone plans to use this. * </p> - * + * * @param qualifier qualifier including package name and qualified type name * May be <code>null</code>, then any qualifier name is accepted. * @param qualifierMatchRule match rule for the qualifier and can be one of @@ -888,7 +888,7 @@ public class SearchEngine { * <li>{@link SearchPattern#R_CAMELCASE_MATCH} if the package name and types are * camel case of the package and type of searched methods.</li> * <li>{@link SearchPattern#R_CAMELCASE_SAME_PART_COUNT_MATCH} - * if the package name and type names are camel case with same part count of the + * if the package name and type names are camel case with same part count of the * package and types of searched methods.</li> * </ul> * @param methodName the method name searched for. @@ -898,7 +898,7 @@ public class SearchEngine { * is exact.</li> * <li>{@link SearchPattern#R_PREFIX_MATCH} if method * name is prefix of the names of the searched methods.</li> - * <li>{@link SearchPattern#R_PATTERN_MATCH} if the method name + * <li>{@link SearchPattern#R_PATTERN_MATCH} if the method name * contains wild-cards.</li> * <li>{@link SearchPattern#R_CAMELCASE_MATCH} if the method name is a * camel case of the searched method name.</li> @@ -919,7 +919,7 @@ public class SearchEngine { * @param progressMonitor the progress monitor to report progress to, or <code>null</code> if no progress * monitor is provided * @exception JavaModelException if the search failed. - * + * * @since 3.12 */ public void searchAllMethodNames( @@ -935,7 +935,7 @@ public class SearchEngine { this.basicEngine.searchAllMethodNames( qualifier, qualifierMatchRule, methodName, methodMatchRule, - scope, requestorWrapper, + scope, requestorWrapper, waitingPolicy, progressMonitor); } /** diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchMatch.java index 4af7455ed..45b54d262 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchMatch.java @@ -20,7 +20,7 @@ import org.eclipse.jdt.internal.core.JavaElement; /** * A search match represents the result of a search query. - * + * * Search matches may be accurate (<code>A_ACCURATE</code>) or they might be * merely potential matches (<code>A_INACCURATE</code>). The latter occurs when * a compile-time problem prevents the search engine from completely resolving @@ -28,15 +28,15 @@ import org.eclipse.jdt.internal.core.JavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @see SearchEngine#search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, org.eclipse.core.runtime.IProgressMonitor) * @since 3.0 */ public class SearchMatch { - + /** * The search result corresponds an exact match of the search pattern. - * + * * @see #getAccuracy() */ public static final int A_ACCURATE = 0; @@ -45,7 +45,7 @@ public class SearchMatch { * The search result is potentially a match for the search pattern, * but the search engine is unable to fully check it (for example, because * there are errors in the code or the classpath are not correctly set). - * + * * @see #getAccuracy() */ public static final int A_INACCURATE = 1; @@ -56,23 +56,23 @@ public class SearchMatch { */ public static final int A_CHECKED = 4; // SH} - + private Object element; private int length; private int offset; private int accuracy; - private SearchParticipant participant; + private SearchParticipant participant; private IResource resource; private boolean insideDocComment = false; - + // store the rule used while reporting the 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; private boolean implicit = false; @@ -82,7 +82,7 @@ public class SearchMatch { * <p> * Note that <code>isInsideDocComment()</code> defaults to false. * </p> - * + * * @param element the element that encloses or corresponds to the match, * or <code>null</code> if none * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} @@ -94,9 +94,9 @@ public class SearchMatch { public SearchMatch( IJavaElement element, int accuracy, - int offset, + int offset, int length, - SearchParticipant participant, + SearchParticipant participant, IResource resource) { this.element = element; this.offset = offset; @@ -115,7 +115,7 @@ public class SearchMatch { /** * Returns the accuracy of this search match. - * + * * @return one of {@link #A_ACCURATE} or {@link #A_INACCURATE} */ public final int getAccuracy() { @@ -126,7 +126,7 @@ public class SearchMatch { * Returns the element of this search match. * In case of a reference match, this is the inner-most enclosing element of the reference. * In case of a declaration match, this is the declaration. - * + * * @return the element of the search match, or <code>null</code> if none */ public final Object getElement() { @@ -135,34 +135,34 @@ public class SearchMatch { /** * Returns the length of this search match. - * + * * @return the length of this search match, or -1 if unknown */ public final int getLength() { return this.length; } - + /** * Returns the offset of this search match. - * + * * @return the offset of this search match, or -1 if unknown */ public final int getOffset() { return this.offset; } - + /** * Returns the search participant which issued this search match. - * + * * @return the participant which issued this search match */ public final SearchParticipant getParticipant() { return this.participant; } - + /** * Returns the resource containing this search match. - * + * * @return the resource of the match, or <code>null</code> if none */ public final IResource getResource() { @@ -171,7 +171,7 @@ public class SearchMatch { /** * Returns the rule used while creating the match. - * + * * @return one of {@link SearchPattern#R_FULL_MATCH}, {@link SearchPattern#R_EQUIVALENT_MATCH} * or {@link SearchPattern#R_ERASURE_MATCH} * @since 3.1 @@ -183,8 +183,8 @@ public class SearchMatch { /** * Returns whether match element is compatible with searched pattern or not. * Note that equivalent matches are also erasure ones. - * - * @return <code>true</code> if match element is compatible + * + * @return <code>true</code> if match element is compatible * <code>false</code> otherwise * @since 3.1 */ @@ -196,7 +196,7 @@ public class SearchMatch { * Returns whether match element only has same erasure than searched pattern or not. * Note that this is always true for both generic and non-generic element as soon * as the accuracy is accurate. - * + * * @return <code>true</code> if match element has same erasure * <code>false</code> otherwise * @since 3.1 @@ -208,7 +208,7 @@ public class SearchMatch { /** * Returns whether element matches exactly searched pattern or not. * Note that exact matches are also erasure and equivalent ones. - * + * * @return <code>true</code> if match is exact * <code>false</code> otherwise * @since 3.1 @@ -219,10 +219,10 @@ public class SearchMatch { /** * Returns whether the associated element is implicit or not. - * + * * Note that this piece of information is currently only implemented * for implicit member pair value in annotation. - * + * * @return <code>true</code> if this match is associated to an implicit * element and <code>false</code> otherwise * @since 3.1 @@ -233,7 +233,7 @@ public class SearchMatch { /** * Returns whether the associated element is a raw type/method or not. - * + * * @return <code>true</code> if this match is associated to a raw * type or method and <code>false</code> otherwise * @since 3.1 @@ -245,7 +245,7 @@ public class SearchMatch { /** * Returns whether this search match is inside a doc comment of a Java * source file. - * + * * @return <code>true</code> if this search match is inside a doc * comment, and <code>false</code> otherwise */ @@ -256,7 +256,7 @@ public class SearchMatch { /** * Sets the accuracy of this match. - * + * * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} */ public final void setAccuracy (int accuracy) { @@ -265,7 +265,7 @@ public class SearchMatch { /** * Sets the element of this search match. - * + * * @param element the element that encloses or corresponds to the match, * or <code>null</code> if none */ @@ -276,7 +276,7 @@ public class SearchMatch { /** * Sets whether this search match is inside a doc comment of a Java * source file. - * + * * @param insideDoc <code>true</code> if this search match is inside a doc * comment, and <code>false</code> otherwise */ @@ -288,7 +288,7 @@ public class SearchMatch { * Sets whether the associated element is implicit or not. * Typically, this is the case when match is on an implicit constructor * or an implicit member pair value in annotation. - * + * * @param implicit <code>true</code> if this match is associated to an implicit * element and <code>false</code> otherwise * @since 3.1 @@ -299,16 +299,16 @@ public class SearchMatch { /** * Sets the length of this search match. - * + * * @param length the length of the match, or -1 if unknown */ public final void setLength(int length) { this.length = length; } - + /** * Sets the offset of this search match. - * + * * @param offset the offset the match starts at, or -1 if unknown */ public final void setOffset(int offset) { @@ -317,7 +317,7 @@ public class SearchMatch { /** * Sets the participant of this match. - * + * * @param participant the search participant that created this match */ public final void setParticipant (SearchParticipant participant) { @@ -326,7 +326,7 @@ public class SearchMatch { /** * Sets the resource of this match. - * + * * @param resource the resource of the match, or <code>null</code> if none */ public final void setResource (IResource resource) { @@ -335,7 +335,7 @@ public class SearchMatch { /** * Set the rule used while reporting the match. - * + * * @param rule one of {@link SearchPattern#R_FULL_MATCH}, {@link SearchPattern#R_EQUIVALENT_MATCH} * or {@link SearchPattern#R_ERASURE_MATCH} * @since 3.1 @@ -346,7 +346,7 @@ public class SearchMatch { /** * Set whether the associated element is a raw type/method or not. - * + * * @param raw <code>true</code> if this search match is associated to a raw * type or method and <code>false</code> otherwise * @since 3.1 diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java index 3a94c4e4b..9c9996717 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java @@ -26,7 +26,7 @@ import org.eclipse.jdt.internal.core.search.indexing.IndexManager; * mechanism, permitting combined search actions which will involve all required * participants. * <p> - * A search participant is involved in the indexing phase and in the search phase. + * A search participant is involved in the indexing phase and in the search phase. * The indexing phase consists in taking one or more search documents, parse them, and * add index entries in an index chosen by the participant. An index is identified by a * path on disk. @@ -36,7 +36,7 @@ import org.eclipse.jdt.internal.core.search.indexing.IndexManager; * finally the search participant is asked to locate the matches precisely in these search documents. * </p> * <p> - * This class is intended to be subclassed by clients. During the indexing phase, + * This class is intended to be subclassed by clients. During the indexing phase, * a subclass will be called with the following requests in order: * <ul> * <li>{@link #scheduleDocumentIndexing(SearchDocument, IPath)}</li> @@ -62,7 +62,7 @@ public abstract class SearchParticipant { protected SearchParticipant() { // do nothing } - + /** * Notification that this participant's help is needed in a search. * <p> @@ -103,10 +103,10 @@ public abstract class SearchParticipant { * The given document path is a string that uniquely identifies the document. * Most of the time it is a workspace-relative path, but it can also be a file system path, or a path inside a zip file. * <p> - * Implementors of this method can either create an instance of their own subclass of + * Implementors of this method can either create an instance of their own subclass of * {@link SearchDocument} or return an existing instance of such a subclass. * </p> - * + * * @param documentPath the path of the document. * @return a search document */ @@ -114,14 +114,14 @@ public abstract class SearchParticipant { /** * Indexes the given document in the given index. A search participant - * asked to index a document should parse it and call + * asked to index a document should parse it and call * {@link SearchDocument#addIndexEntry(char[], char[])} as many times as * needed to add index entries to the index. If delegating to another * participant, it should use the original index location (and not the * delegatee's one). In the particular case of delegating to the default * search participant (see {@link SearchEngine#getDefaultSearchParticipant()}), - * the provided document's path must be a path ending with one of the - * {@link org.eclipse.jdt.core.JavaCore#getJavaLikeExtensions() Java-like extensions} + * the provided document's path must be a path ending with one of the + * {@link org.eclipse.jdt.core.JavaCore#getJavaLikeExtensions() Java-like extensions} * or with '.class'. * <p> * The given index location must represent a path in the file system to a file that @@ -130,7 +130,7 @@ public abstract class SearchParticipant { * </p><p> * Clients are not expected to call this method. * </p> - * + * * @param document the document to index * @param indexLocation the location in the file system to the index */ @@ -158,7 +158,7 @@ public abstract class SearchParticipant { * * @param document the document to index * @param indexLocation the location in the file system to the index - * + * * @since 3.10 */ public void indexResolvedDocument(SearchDocument document, IPath indexLocation) { @@ -179,10 +179,10 @@ public abstract class SearchParticipant { * </p><p> * Implementors of this method should check the progress monitor * for cancelation when it is safe and appropriate to do so. The cancelation - * request should be propagated to the caller by throwing + * request should be propagated to the caller by throwing * <code>OperationCanceledException</code>. * </p> - * + * * @param documents the documents to locate matches in * @param pattern the search pattern to use when locating matches * @param scope the scope to limit the search to @@ -194,7 +194,7 @@ public abstract class SearchParticipant { public abstract void locateMatches(SearchDocument[] documents, SearchPattern pattern, IJavaSearchScope scope, SearchRequestor requestor, IProgressMonitor monitor) throws CoreException; /** - * Removes the index for a given path. + * Removes the index for a given path. * <p> * The given index location must represent a path in the file system to a file that * already exists and must be an index file, otherwise nothing will be done. @@ -202,7 +202,7 @@ public abstract class SearchParticipant { * It is strongly recommended to use this method instead of deleting file directly * otherwise cached index will not be removed. * </p> - * + * * @param indexLocation the location in the file system to the index * @since 3.2 */ @@ -212,7 +212,7 @@ public abstract class SearchParticipant { } /** - * Resolves the given document. A search participant asked to resolve a document should parse it and + * Resolves the given document. A search participant asked to resolve a document should parse it and * resolve the types and preserve enough state to be able to tend to a indexResolvedDocument call * subsequently. This API is invoked without holding any index related locks or monitors. * <p> @@ -227,10 +227,10 @@ public abstract class SearchParticipant { public void resolveDocument(SearchDocument document) { // do nothing, subtypes should do the "appropriate thing" } - + /** * Schedules the indexing of the given document. - * Once the document is ready to be indexed, + * Once the document is ready to be indexed, * {@link #indexDocument(SearchDocument, IPath) indexDocument(document, indexPath)} * will be called in a different thread than the caller's thread. * <p> @@ -241,7 +241,7 @@ public abstract class SearchParticipant { * When the index is no longer needed, clients should use {@link #removeIndex(IPath) } * to discard it. * </p> - * + * * @param document the document to index * @param indexPath the location on the file system of the index */ @@ -271,11 +271,11 @@ public abstract class SearchParticipant { * given search query in the given scope. The search engine calls this * method before locating matches. * <p> - * An index location represents a path in the file system to a file that holds index information. + * An index location represents a path in the file system to a file that holds index information. * </p><p> * Clients are not expected to call this method. * </p> - * + * * @param query the search pattern to consider * @param scope the given search scope * @return the collection of index paths to consider diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java index 955050962..5fc4abb32 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java @@ -222,7 +222,7 @@ public abstract class SearchPattern { * of other match rule flags are combined with this one, then match rule validation * will return a modified rule in order to perform a better appropriate search request * (see {@link #validateMatchRule(String, int)} for more details). - * + * * <p> * This is implemented only for code assist and not available for normal search. * @@ -243,7 +243,7 @@ public abstract class SearchPattern { * of other match rule flags are combined with this one, then match rule validation * will return a modified rule in order to perform a better appropriate search request * (see {@link #validateMatchRule(String, int)} for more details). - * + * * <p> * This is implemented only for code assist and not available for normal search. * @@ -263,7 +263,7 @@ public abstract class SearchPattern { /** * The focus element (used for reference patterns) - * @noreference This field is not intended to be referenced by clients. + * @noreference This field is not intended to be referenced by clients. */ public IJavaElement focus; @@ -271,12 +271,12 @@ public abstract class SearchPattern { * @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. @@ -358,14 +358,14 @@ public void acceptMatch(String relativePath, String containerPath, char separato String documentPath = buffer.toString(); boolean encloses = (scope instanceof HierarchyScope) ? ((HierarchyScope)scope).encloses(documentPath, monitor) : scope.encloses(documentPath); - if (encloses) + if (encloses) if (!requestor.acceptIndexMatch(documentPath, pattern, participant, null)) throw new OperationCanceledException(); } } /** - * @noreference This method is not intended to be referenced by clients. + * @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 SearchPattern currentPattern() { @@ -836,7 +836,7 @@ public static final boolean camelCaseMatch(String pattern, int patternStart, int * <code>'?*'</code>, <code>'???'</code>, etc.) when using a pattern * match rule. * </p> - * + * * @since 3.5 */ public static final int[] getMatchingRegions(String pattern, String name, int matchRule) { @@ -1478,7 +1478,7 @@ private static SearchPattern createPackagePattern(String patternString, int limi * Unnamed modules can also be included and are represented either by an absence of module name implicitly * or explicitly by specifying ALL-UNNAMED for module name. * Module graph search is also supported with the limitTo option set to <code>IJavaSearchConstants.MODULE_GRAPH</code>. - * In the module graph case, the given type is searched in all the modules required directly as well + * In the module graph case, the given type is searched in all the modules required directly as well * as indirectly by the given module(s). * </p> * <p> @@ -1490,7 +1490,7 @@ private static SearchPattern createPackagePattern(String patternString, int limi * <li><code>java.base/java.lang.Object</code></li> * <li><code>mod.one, mod.two/pack.X</code> find declaration in the list of given modules.</li> * <li><code>/pack.X</code> find in the unnamed module.</li> - * <li><code>ALL-UNNAMED/pack.X</code> find in the unnamed module.</li> + * <li><code>ALL-UNNAMED/pack.X</code> find in the unnamed module.</li> * </ul> * <p> * </li> @@ -1566,12 +1566,12 @@ private static SearchPattern createPackagePattern(String patternString, int limi * Note that types may be only classes or only interfaces if {@link IJavaSearchConstants#CLASS CLASS} or * {@link IJavaSearchConstants#INTERFACE INTERFACE} is respectively used instead of {@link IJavaSearchConstants#TYPE TYPE}. * </li> - * <li>{@link IJavaSearchConstants#MODULE_GRAPH MODULE_GRAPH}: for types with a module prefix, + * <li>{@link IJavaSearchConstants#MODULE_GRAPH MODULE_GRAPH}: for types with a module prefix, * will find all types present in required modules (directly or indirectly required) ie * in any module present in the module graph of the given module. * </li> * <li>All other fine grain constants defined in the <b>limitTo</b> category - * of the {@link IJavaSearchConstants} are also accepted nature: + * of the {@link IJavaSearchConstants} are also accepted nature: * <table> * <tr> * <th>Fine grain constant @@ -1665,7 +1665,7 @@ private static SearchPattern createPackagePattern(String patternString, int limi * on non-generic types/methods search.</p> * * <p>Note that {@link #R_REGEXP_MATCH} is supported since 3.14 for the special case of - * {@link IJavaSearchConstants#DECLARATIONS DECLARATIONS} search of + * {@link IJavaSearchConstants#DECLARATIONS DECLARATIONS} search of * {@link IJavaSearchConstants#MODULE MODULE}</p> * <p> * Note also that the default behavior for generic types/methods search is to find exact matches.</p> @@ -1757,7 +1757,7 @@ public static SearchPattern createPattern(String stringPattern, int searchFor, i * references as specified above. * </li> * <li>All other fine grain constants defined in the <b>limitTo</b> category - * of the {@link IJavaSearchConstants} are also accepted nature: + * of the {@link IJavaSearchConstants} are also accepted nature: * <table> * <tr> * <th>Fine grain constant @@ -1869,7 +1869,7 @@ public static SearchPattern createPattern(IJavaElement element, int limitTo) { * references as specified above. * </li> * <li>All other fine grain constants defined in the <b>limitTo</b> category - * of the {@link IJavaSearchConstants} are also accepted nature: + * of the {@link IJavaSearchConstants} are also accepted nature: * <table> * <tr> * <th>Fine grain constant @@ -2074,18 +2074,18 @@ public static SearchPattern createPattern(IJavaElement element, int limitTo, int typeParam, matchRule); break; -//{ObjectTeams: patterns for method mappings: +//{ObjectTeams: patterns for method mappings: case IOTJavaElement.CALLOUT_MAPPING: case IOTJavaElement.CALLOUT_TO_FIELD_MAPPING: // treat as a method declaration: method = (IMethod)((AbstractCalloutMapping)element).getCorrespondingJavaElement(); ignoreReturnType = true; // return type is not resolved -// orig: +// orig: //$FALL-THROUGH$ - case IJavaElement.METHOD : + case IJavaElement.METHOD : /* IMethod method = (IMethod) element; - :giro */ + :giro */ if (method == null) method = (IMethod) element; IType declaringRoleClass= null; @@ -2253,7 +2253,7 @@ private static SearchPattern createTypePattern(char[] simpleName, char[] package //{ObjectTeams: search base class references: case IJavaSearchConstants.PLAYEDBY_REFERENCES : return new SuperTypeReferencePattern( - CharOperation.concatWith(packageName, enclosingTypeNames, '.'), + CharOperation.concatWith(packageName, enclosingTypeNames, '.'), simpleName, SuperTypeReferencePattern.ONLY_BASE_CLASSES, matchRule); @@ -2390,7 +2390,7 @@ private static SearchPattern createTypePattern(String patternString, int limitTo case IJavaSearchConstants.IMPLEMENTORS : return new SuperTypeReferencePattern(qualificationChars, typeChars, SuperTypeReferencePattern.ONLY_SUPER_INTERFACES, indexSuffix, matchRule); //{ObjectTeams: search base class references: - case IJavaSearchConstants.PLAYEDBY_REFERENCES : + case IJavaSearchConstants.PLAYEDBY_REFERENCES : return new SuperTypeReferencePattern(qualificationChars, typeChars, SuperTypeReferencePattern.ONLY_BASE_CLASSES, indexSuffix, matchRule); // SH} case IJavaSearchConstants.ALL_OCCURRENCES : @@ -2450,8 +2450,8 @@ public void decodeIndexKey(char[] key) { } /** * 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. + * + * @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 { @@ -2534,7 +2534,7 @@ public final int getMatchRule() { return this.matchRule; } /** - * @noreference This method is not intended to be referenced by clients. + * @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 boolean isPolymorphicSearch() { @@ -2722,7 +2722,7 @@ public static int validateMatchRule(String stringPattern, int matchRule) { // enabling special cases (read regular expressions) based on searchFor and limitTo private static int validateMatchRule(String stringPattern, int searchFor, int limitTo, int matchRule) { - if (searchFor == IJavaSearchConstants.MODULE && + if (searchFor == IJavaSearchConstants.MODULE && limitTo == IJavaSearchConstants.DECLARATIONS && matchRule == SearchPattern.R_REGEXP_MATCH) return matchRule; @@ -2755,7 +2755,7 @@ private static boolean validateCamelCasePattern(String stringPattern) { } /** - * @noreference This method is not intended to be referenced by clients. + * @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 { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchRequestor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchRequestor.java index 442edeab1..e7819fa37 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchRequestor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchRequestor.java @@ -16,7 +16,7 @@ package org.eclipse.jdt.core.search; import org.eclipse.core.runtime.CoreException; /** - * Collects the results from a search engine query. + * Collects the results from a search engine query. * Clients implement a subclass to pass to <code>SearchEngine.search</code> * and implement the {@link #acceptSearchMatch(SearchMatch)} method, and * possibly override other life cycle methods. @@ -75,7 +75,7 @@ public abstract class SearchRequestor { * The default implementation of this method does nothing. Subclasses * may override. * </p> - * + * * @param participant the participant that is starting to contribute */ public void enterParticipant(SearchParticipant participant) { @@ -89,7 +89,7 @@ public abstract class SearchRequestor { * The default implementation of this method does nothing. Subclasses * may override. * </p> - * + * * @param participant the participant that finished contributing */ public void exitParticipant(SearchParticipant participant) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeDeclarationMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeDeclarationMatch.java index 858b9f666..5c5a892e3 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeDeclarationMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeDeclarationMatch.java @@ -22,14 +22,14 @@ import org.eclipse.jdt.core.IJavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.0 */ public class TypeDeclarationMatch extends SearchMatch { /** * Creates a new type declaration match. - * + * * @param element the type declaration * @param accuracy one of A_ACCURATE or A_INACCURATE * @param offset the offset the match starts at, or -1 if unknown diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameMatch.java index e1786bbe0..0b1b770f4 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameMatch.java @@ -16,12 +16,12 @@ package org.eclipse.jdt.core.search; import org.eclipse.jdt.core.*; /** - * A match collected while {@link SearchEngine searching} for + * A match collected while {@link SearchEngine searching} for * all type names methods using a {@link TypeNameRequestor requestor}. * <p> * The type of this match is available from {@link #getType()}. * </p> - * + * * @noextend This class is not intended to be subclassed by clients. * * @see TypeNameMatchRequestor @@ -48,10 +48,10 @@ public abstract int getAccessibility(); /** * Returns the matched type's fully qualified name using '.' character * as separator (e.g. package name + '.' enclosing type names + '.' simple name). - * + * * @see #getType() * @see IType#getFullyQualifiedName(char) - * + * * @throws NullPointerException if matched type is <code> null</code> * @return Fully qualified type name of the type */ @@ -64,7 +64,7 @@ public String getFullyQualifiedName() { * <p> * This is a handle-only method as neither Java Model nor classpath * initialization is done while calling this method. - * + * * @return the type modifiers */ public abstract int getModifiers(); @@ -72,10 +72,10 @@ public abstract int getModifiers(); /** * Returns the package fragment root of the stored type. * Package fragment root cannot be null and <strong>does</strong> exist. - * + * * @see #getType() * @see IJavaElement#getAncestor(int) - * + * * @throws NullPointerException if matched type is <code> null</code> * @return the existing java model package fragment root (i.e. cannot be <code>null</code> * and will return <code>true</code> to <code>exists()</code> message). @@ -86,10 +86,10 @@ public IPackageFragmentRoot getPackageFragmentRoot() { /** * Returns the package name of the stored type. - * + * * @see #getType() * @see IType#getPackageFragment() - * + * * @throws NullPointerException if matched type is <code> null</code> * @return the package name */ @@ -99,10 +99,10 @@ public String getPackageName() { /** * Returns the name of the stored type. - * + * * @see #getType() * @see IJavaElement#getElementName() - * + * * @throws NullPointerException if matched type is <code> null</code> * @return the type name */ @@ -116,7 +116,7 @@ public String getSimpleTypeName() { * <p> * This is a handle-only method as neither Java Model nor classpath * initializations are done while calling this method. - * + * * @see IType * @return the non-null handle on matched java model type. */ @@ -125,10 +125,10 @@ public abstract IType getType(); /** * Name of the type container using '.' character * as separator (e.g. package name + '.' + enclosing type names). - * + * * @see #getType() * @see IMember#getDeclaringType() - * + * * @throws NullPointerException if matched type is <code> null</code> * @return name of the type container */ @@ -144,10 +144,10 @@ public String getTypeContainerName() { /** * Returns the matched type's type qualified name using '.' character * as separator (e.g. enclosing type names + '.' + simple name). - * + * * @see #getType() * @see IType#getTypeQualifiedName(char) - * + * * @throws NullPointerException if matched type is <code> null</code> * @return fully qualified type name of the type */ diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameMatchRequestor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameMatchRequestor.java index 6f92fc0e0..ac2b53438 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameMatchRequestor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameMatchRequestor.java @@ -17,12 +17,12 @@ package org.eclipse.jdt.core.search; * 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 * {@link SearchEngine#searchAllTypeNames( - * char[] packageName, - * int packageMatchRule, + * char[] packageName, + * int packageMatchRule, * char[] typeName, - * int typeMatchRule, - * int searchFor, - * IJavaSearchScope scope, + * int typeMatchRule, + * int searchFor, + * IJavaSearchScope scope, * TypeNameMatchRequestor nameMatchRequestor, * int waitingPolicy, * org.eclipse.core.runtime.IProgressMonitor monitor)} method. @@ -37,7 +37,7 @@ package org.eclipse.jdt.core.search; * </p> * @see TypeNameMatch * @see TypeNameRequestor - * + * * @since 3.3 */ public abstract class TypeNameMatchRequestor { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameRequestor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameRequestor.java index 19c6cca42..7cc9b5974 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameRequestor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameRequestor.java @@ -47,9 +47,9 @@ public abstract class TypeNameRequestor { * @param path the full path to the resource containing the type. If the resource is a .class file * or a source file, this is the full path in the workspace to this resource. If the * resource is an archive (that is, a .zip or .jar file), the path is composed of 2 paths separated - * by <code>IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR</code>: - * the first path is the full OS path to the archive (if it is an external archive), - * or the workspace relative <code>IPath</code> to the archive (if it is an internal archive), + * by <code>IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR</code>: + * the first path is the full OS path to the archive (if it is an external archive), + * or the workspace relative <code>IPath</code> to the archive (if it is an internal archive), * the second path is the path to the resource inside the archive. */ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeParameterDeclarationMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeParameterDeclarationMatch.java index 214632684..19a14ab7a 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeParameterDeclarationMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeParameterDeclarationMatch.java @@ -22,14 +22,14 @@ import org.eclipse.jdt.core.IJavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.1 */ public class TypeParameterDeclarationMatch extends SearchMatch { /** * Creates a new type parameter match. - * + * * @param element the type parameter * @param accuracy one of A_ACCURATE or A_INACCURATE * @param offset the offset the match starts at, or -1 if unknown diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeParameterReferenceMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeParameterReferenceMatch.java index 1eaf47a5b..85917d1d4 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeParameterReferenceMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeParameterReferenceMatch.java @@ -22,14 +22,14 @@ import org.eclipse.jdt.core.IJavaElement; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.1 */ public class TypeParameterReferenceMatch extends SearchMatch { /** * Creates a new field reference match. - * + * * @param enclosingElement the inner-most enclosing member that references this field * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} * @param offset the offset the match starts at, or -1 if unknown diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeReferenceMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeReferenceMatch.java index 3b45b077f..76c067e6b 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeReferenceMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeReferenceMatch.java @@ -22,7 +22,7 @@ import org.eclipse.jdt.core.*; * <p> * This class is intended to be instantiated and subclassed by clients. * </p> - * + * * @since 3.0 */ public class TypeReferenceMatch extends ReferenceMatch { @@ -31,7 +31,7 @@ public class TypeReferenceMatch extends ReferenceMatch { /** * Creates a new type reference match. - * + * * @param enclosingElement the inner-most enclosing member that references this type * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} * @param offset the offset the match starts at, or -1 if unknown @@ -58,7 +58,7 @@ public TypeReferenceMatch(IJavaElement enclosingElement, int accuracy, int offse * void method() {} * } * </pre> - * will return one match whose other elements is an array of two fields: + * will return one match whose other elements is an array of two fields: * {@link IField test2} and {@link IField test3}. * <br><br> * </li> @@ -71,7 +71,7 @@ public TypeReferenceMatch(IJavaElement enclosingElement, int accuracy, int offse * } * } * </pre> - * will return one match whose other elements is an array of two local + * will return one match whose other elements is an array of two local * variables: {@link ILocalVariable local2} and {@link ILocalVariable local3}. * <br><br> * </li> @@ -90,7 +90,7 @@ public TypeReferenceMatch(IJavaElement enclosingElement, int accuracy, int offse * {@link ILocalVariable test2}. * </li> * </ul> - * + * * @return the other elements of the search match, or <code>null</code> if none * @since 3.2 */ @@ -100,9 +100,9 @@ public final IJavaElement[] getOtherElements() { /** * Sets the other elements of this search match. - * + * * @see #getOtherElements() - * + * * @param otherElements the other elements of the match, * or <code>null</code> if none * @since 3.2 diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java index 4c9c865b1..2f8fca18b 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java @@ -89,7 +89,7 @@ int[] asArray() { int[] result = new int[this.size]; System.arraycopy(this.elements, 0, result, 0, this.size); return result; -} +} } @@ -174,7 +174,7 @@ HashtableOfObject addQueryResults(char[][] categories, char[] key, int matchRule if (this.categoryOffsets == null) return null; // file is empty HashtableOfObject results = null; // initialized if needed - + // No need to check the results table for duplicates while processing the // first category table or if the first category tables doesn't have any results. boolean prevResults = false; @@ -914,17 +914,17 @@ private void readStreamBuffer(InputStream stream) throws IOException { this.bufferIndex = 0; } /** - * Reads in a string from the specified data input stream. The - * string has been encoded using a modified UTF-8 format. + * Reads in a string from the specified data input stream. The + * string has been encoded using a modified UTF-8 format. * <p> * The first two bytes are read as an unsigned short. * This value gives the number of following bytes that are in the encoded string, - * not the length of the resulting string. The following bytes are then - * interpreted as bytes encoding characters in the UTF-8 format - * and are converted into characters. + * not the length of the resulting string. The following bytes are then + * interpreted as bytes encoding characters in the UTF-8 format + * and are converted into characters. * <p> - * This method blocks until all the bytes are read, the end of the - * stream is detected, or an exception is thrown. + * This method blocks until all the bytes are read, the end of the + * stream is detected, or an exception is thrown. * * @param stream a data input stream. * @return UTF decoded string as a char array @@ -1254,12 +1254,12 @@ private void writeOffsetToHeader(int offsetToHeader) throws IOException { } } /** - * Writes a string to the given output stream using UTF-8 - * encoding in a machine-independent manner. + * Writes a string to the given output stream using UTF-8 + * encoding in a machine-independent manner. * <p> - * First, two bytes of the array are giving the number of bytes to - * follow. This value is the number of bytes actually written out, - * not the length of the string. Following the length, each character + * First, two bytes of the array are giving the number of bytes to + * follow. This value is the number of bytes actually written out, + * not the length of the string. Following the length, each character * of the string is put in the bytes array, in sequence, using the UTF-8 * encoding for the character. * </p> diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/FileIndexLocation.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/FileIndexLocation.java index 60cecd5f5..726b881d8 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/FileIndexLocation.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/FileIndexLocation.java @@ -70,7 +70,7 @@ public class FileIndexLocation extends IndexLocation { public String fileName() { return this.indexFile.getName(); } - + @Override public File getIndexFile() { return this.indexFile; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/Index.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/Index.java index bddc8e580..7a333cb35 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/Index.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/Index.java @@ -187,7 +187,7 @@ public void remove(String containerRelativePath) { } /** * Reset memory and disk indexes. - * + * * @throws IOException */ public void reset() throws IOException { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/IndexLocation.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/IndexLocation.java index b913ec1bc..bcac15132 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/IndexLocation.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/IndexLocation.java @@ -26,13 +26,13 @@ import org.eclipse.core.runtime.IPath; /** * The location of the index files are represented as {@link IndexLocation} - * + * * This is an abstract class to allow different implementation for a jar entry and a file * on the disk. Some of these functions could mean different for a jar entry or a file - * + * */ public abstract class IndexLocation { - + public static IndexLocation createIndexLocation(URL url) { URL localUrl; try { @@ -53,16 +53,16 @@ public abstract class IndexLocation { } return new JarIndexLocation(url, localUrl); } - + private final URL url; // url of the given index location /** * Set to true if this index location is of an index file specified - * by a participant through + * by a participant through * {@link org.eclipse.jdt.core.search.SearchParticipant#scheduleDocumentIndexing} */ protected boolean participantIndex; - + protected IndexLocation(File file) { URL tempUrl = null; try { @@ -72,7 +72,7 @@ public abstract class IndexLocation { } this.url = tempUrl; } - + public IndexLocation(URL url) { this.url = url; } @@ -94,7 +94,7 @@ public abstract class IndexLocation { public abstract boolean delete(); public abstract boolean exists(); - + public abstract String fileName(); /** diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/IndexExceptionBuilder.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/IndexExceptionBuilder.java index 785f59f02..ed2b90e51 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/IndexExceptionBuilder.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/IndexExceptionBuilder.java @@ -50,7 +50,7 @@ public final class IndexExceptionBuilder { /** * Adds an address range to this problem description, given a field that may be corrupt, the base * address for its struct, and a custom description for the field. - * + * * @return this */ public IndexExceptionBuilder addProblemAddress(String description, IField field, long address) { @@ -62,7 +62,7 @@ public final class IndexExceptionBuilder { /** * Adds an address range to this problem description, given the field that may be corrupt * and the base address for its struct. - * + * * @return this */ public IndexExceptionBuilder addProblemAddress(IField field, long address) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/Nd.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/Nd.java index 44d48f721..13f027630 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/Nd.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/Nd.java @@ -171,7 +171,7 @@ public final class Nd { } /** - * Inserts a cookie that can be later retrieved via getData(String). + * Inserts a cookie that can be later retrieved via getData(String). */ public <T> void setData(Class<T> key, T value) { synchronized (this.cookies) { @@ -711,7 +711,7 @@ public final class Nd { } /** - * Creates a {@link IndexExceptionBuilder} object that collects information about database corruption after it is + * Creates a {@link IndexExceptionBuilder} object that collects information about database corruption after it is * detected. */ public IndexExceptionBuilder describeProblem() { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/RawGrowableArray.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/RawGrowableArray.java index 7279420b3..e3ed5c94c 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/RawGrowableArray.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/RawGrowableArray.java @@ -28,7 +28,7 @@ import org.eclipse.jdt.internal.core.nd.util.MathUtils; * <p> * The memory format contains a header is as follows: * <p> - * + * * <pre> * Byte Meaning * -------------------------------------------- @@ -38,7 +38,7 @@ import org.eclipse.jdt.internal.core.nd.util.MathUtils; * ... * k...k+4 Record [inlineRecordCount-1] * </pre> - * + * * As shown above, the first few records are stored inline with the array. inlineRecordCount is a tunable parameter * which may be 0. If there are fewer than inlineRecordCount records, there is no growable block and all records are * stored in the header. Storing the first few records in the header is intended as an optimization for very small @@ -49,7 +49,7 @@ import org.eclipse.jdt.internal.core.nd.util.MathUtils; * <p> * The memory format for a growable block is as follows: * <p> - * + * * <pre> * Byte Meaning * -------------------------------------------- @@ -61,7 +61,7 @@ import org.eclipse.jdt.internal.core.nd.util.MathUtils; * ... * k...k+4 Record [blockSize-1] * </pre> - * + * * <p> * The growable block itself begins with a 4-byte int holding the size of the array, followed by a 4-byte int holding * the capacity of the growable block. In the event that the array is larger than @@ -103,7 +103,7 @@ public final class RawGrowableArray { private static final FieldPointer GROWABLE_BLOCK_ADDRESS; private static final int ARRAY_HEADER_BYTES; - private static final StructDef<RawGrowableArray> type; + private static final StructDef<RawGrowableArray> type; static { type = StructDef.createAbstract(RawGrowableArray.class); @@ -141,7 +141,7 @@ public final class RawGrowableArray { /** * Holds the number of pages used for the metablock. Note that the start of the metablock array needs to be * 4-byte aligned. Since all malloc calls are always 2 bytes away from 4-byte alignment, we need to use at - * least one short in this struct. */ + * least one short in this struct. */ public static final FieldShort METABLOCK_NUM_PAGES; public static final int META_BLOCK_HEADER_BYTES; @@ -157,7 +157,7 @@ public final class RawGrowableArray { META_BLOCK_HEADER_BYTES = type.size(); } } - + private final int inlineSize; public RawGrowableArray(int inlineRecords) { @@ -170,7 +170,7 @@ public final class RawGrowableArray { /** * Returns the size of the array. - * + * * @param address address of the array * @return the array size, in number elements */ @@ -246,7 +246,7 @@ public final class RawGrowableArray { Database db = nd.getDB(); - int neededBlockSize = getGrowableRegionSizeFor(desiredSize); + int neededBlockSize = getGrowableRegionSizeFor(desiredSize); if (neededBlockSize > GrowableBlockHeader.MAX_GROWABLE_SIZE) { // We need a metablock. long metablockAddress = growableBlockAddress; @@ -482,7 +482,7 @@ public final class RawGrowableArray { /** * Checks if we should reduce the amount of allocated in the growable region, such that the array can hold the given * number of elements. - * + * * @param desiredSize * the new current size of the array or 0 to free up all memory */ @@ -632,10 +632,10 @@ public final class RawGrowableArray { repackIfNecessary(nd, address, 0); } - + /** * Returns true iff the size of the array is 0 - * + * * @param address address of the array * @return the array size, in number elements */ diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/Chunk.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/Chunk.java index 1f4841b8a..e389c7c21 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/Chunk.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/Chunk.java @@ -28,7 +28,7 @@ final class Chunk { final Database fDatabase; /** * Holds the database-specific chunk number. This is the index into the database's chunk array and indicates the - * start of the range of addresses held by this chunk. Non-negative. + * start of the range of addresses held by this chunk. Non-negative. */ final int fSequenceNumber; /** diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/ChunkWriter.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/ChunkWriter.java index bc3723cb6..d4049ee6b 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/ChunkWriter.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/ChunkWriter.java @@ -34,11 +34,11 @@ public class ChunkWriter { /** * Interface used to perform the uninterruptable writes when the buffer fills up. */ - @FunctionalInterface + @FunctionalInterface public interface WriteCallback { /** * Performs an uninterruptable write of the given bytes to the given file position. - * + * * @param buffer * the bytes to write * @param position @@ -54,14 +54,14 @@ public class ChunkWriter { @FunctionalInterface public interface SleepCallback { /** - * Sleeps the caller for the given time (in milliseconds) + * Sleeps the caller for the given time (in milliseconds) */ void sleep(long millisecond) throws InterruptedException; } /** * Constructs a new {@link ChunkWriter} - * + * * @param bufferSize * size of the write buffer (the maximum number of bytes that will be written in a single write). * @param maxBytesPerMillisecond @@ -80,7 +80,7 @@ public class ChunkWriter { /** * Writes the given bytes to the given file position. - * + * * @return true iff any attempt was made to interrupt the thread using {@link Thread#interrupt()}. The write * succeeds regardless of the return value. * @throws IOException if unable to perform the write @@ -104,7 +104,7 @@ public class ChunkWriter { /** * Flushes any outstanding writes to disk immediately. - * + * * @return true iff any attempt was made to interrupt the thread using {@link Thread#interrupt()}. The write * succeeds regardless of the return value. * @throws IOException if unable to perform the write diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/Database.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/Database.java index 01b8e97d3..a831e9a53 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/Database.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/Database.java @@ -65,7 +65,7 @@ import org.eclipse.osgi.util.NLS; * INT_SIZE * (M + 1) | pointer to head of linked list of blocks of size (M + MIN_BLOCK_DELTAS) * BLOCK_SIZE_DELTA * FREE_BLOCK_OFFSET | chunk number for the root of the large block free space trie * WRITE_NUMBER_OFFSET | long integer which is incremented on every write - * MALLOC_STATS_OFFSET | memory usage statistics + * MALLOC_STATS_OFFSET | memory usage statistics * DATA_AREA | The database singletons are stored here and use the remainder of chunk 0 * * M = CHUNK_SIZE / BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS @@ -84,7 +84,7 @@ import org.eclipse.osgi.util.NLS; * offset content * _____________________________ * 0 | size of block (negative indicates the block is in use) (2 bytes) - * 2 | content of the struct + * 2 | content of the struct * */ public class Database { @@ -99,7 +99,7 @@ public class Database { public static final int BLOCK_SIZE_DELTA_BITS = 3; public static final int BLOCK_SIZE_DELTA= 1 << BLOCK_SIZE_DELTA_BITS; - + // Fields that are only used by free blocks private static final int BLOCK_PREV_OFFSET = BLOCK_HEADER_SIZE; private static final int BLOCK_NEXT_OFFSET = BLOCK_HEADER_SIZE + INT_SIZE; @@ -309,8 +309,8 @@ public class Database { /** * Attempts to perform an uninterruptable write operation on the database. Returns true if an attempt was made - * to interrupt it. - * + * to interrupt it. + * * @throws IOException */ private boolean performUninterruptableWrite(IORunnable runnable) throws IOException { @@ -334,7 +334,7 @@ public class Database { } } } - + public void transferTo(FileChannel target) throws IOException { assert this.fLocked; final FileChannel from= this.fFile.getChannel(); @@ -365,7 +365,7 @@ public class Database { * Empty the contents of the Database, make it ready to start again. Interrupting the thread with * {@link Thread#interrupt()} won't interrupt the write. Returns true iff the thread was interrupted * with {@link Thread#interrupt()}. - * + * * @throws IndexException */ public boolean clear(int version) throws IndexException { @@ -434,7 +434,7 @@ public class Database { /** * Return the Chunk that contains the given offset. - * + * * @throws IndexException */ public Chunk getChunk(long offset) throws IndexException { @@ -531,7 +531,7 @@ public class Database { assert this.fExclusiveLock; assert datasize >= 0; assert datasize <= MAX_MALLOC_SIZE; - + long result; int usedSize; this.log.start(this.mallocTag); @@ -549,7 +549,7 @@ public class Database { if (needDeltas < MIN_BLOCK_DELTAS) { needDeltas = MIN_BLOCK_DELTAS; } - + // Which block size. int useDeltas; for (useDeltas = needDeltas; useDeltas <= MAX_BLOCK_DELTAS; useDeltas++) { @@ -557,7 +557,7 @@ public class Database { if (freeBlock != 0) break; } - + // Get the block. Chunk chunk; if (freeBlock == 0) { @@ -579,18 +579,18 @@ public class Database { } removeBlock(chunk, useDeltas * BLOCK_SIZE_DELTA, freeBlock); } - + final int unusedDeltas = useDeltas - needDeltas; if (unusedDeltas >= MIN_BLOCK_DELTAS) { // Add in the unused part of our block. addBlock(chunk, unusedDeltas * BLOCK_SIZE_DELTA, freeBlock + needDeltas * BLOCK_SIZE_DELTA); useDeltas = needDeltas; } - + // Make our size negative to show in use. usedSize = useDeltas * BLOCK_SIZE_DELTA; chunk.putShort(freeBlock, (short) -usedSize); - + // Clear out the block, lots of people are expecting this. chunk.clear(freeBlock + BLOCK_HEADER_SIZE, usedSize - BLOCK_HEADER_SIZE); result = freeBlock + BLOCK_HEADER_SIZE; @@ -616,7 +616,7 @@ public class Database { /** * Clears all the bytes in the given range by setting them to zero. - * + * * @param startAddress first address to clear * @param bytesToClear number of addresses to clear */ @@ -649,7 +649,7 @@ public class Database { /** * Obtains a new block that can fit the given number of bytes (at minimum). Returns the * chunk number. - * + * * @param datasize minimum number of bytes needed * @return the chunk number */ @@ -733,7 +733,7 @@ public class Database { /** * Unlinks a free block (which currently belongs to the free block trie) so that it may * be reused. - * + * * @param freeBlockChunkNum chunk number of the block to be unlinked */ private void unlinkFreeBlock(int freeBlockChunkNum) { @@ -809,7 +809,7 @@ public class Database { /** * Returns the chunk number of a free block that contains at least the given number of chunks, or * 0 if there is no existing contiguous free block containing at least the given number of chunks. - * + * * @param numChunks minumum number of chunks desired * @return the chunk number of a free block containing at least the given number of chunks or 0 * if there is no existing free block containing that many chunks. @@ -834,7 +834,7 @@ public class Database { /** * Given the chunk number of a block somewhere in the free space trie, this returns the smallest * child in the subtree that is no smaller than the given number of chunks. - * + * * @param trieNodeChunkNum chunk number of a block in the free space trie * @param numChunks desired number of chunks * @return the chunk number of the first chunk in a contiguous free block containing at least the @@ -876,7 +876,7 @@ public class Database { /** * Link the given unused block into the free block tries. The block does not need to have * its header filled in already. - * + * * @param freeBlockChunkNum chunk number of the start of the block * @param numChunks number of chunks in the block */ @@ -1056,11 +1056,11 @@ public class Database { } } } - + /** * Adds the given child block to the given parent subtree of the free space trie. Any existing * subtree under the given child block will be retained. - * + * * @param parentChunkNum root of the existing tree, or 0 if the child is going to be the new root * @param newChildChunkNum the new child to insert */ @@ -1097,7 +1097,7 @@ public class Database { * Adds the given block to the linked list of equally-sized free chunks in the free space trie. * Both chunks must be unused, must be the same size, and the previous chunk must already * be linked into the free space trie. The newly-added chunk must not have any children. - * + * * @param prevChunkNum chunk number of previous block in the existing list * @param newChunkNum new chunk to be added to the list */ @@ -1118,7 +1118,7 @@ public class Database { /** * Returns the chunk number of the chunk at the start of a block, given the * chunk number of the chunk at the start of the following block. - * + * * @param chunkNum the chunk number of the chunk immediately following the * chunk being queried * @return the chunk number of the chunk at the start of the previous block @@ -1131,7 +1131,7 @@ public class Database { /** * Sets the block header and footer for the given range of chunks which make * up a contiguous block. - * + * * @param firstChunkNum chunk number of the first chunk in the block * @param headerContent the content of the header. Its magnitude is the number of * chunks in the block. It is positive if the chunk is free and negative if @@ -1325,11 +1325,11 @@ public class Database { } addBlock(chunk, (int) blockSize, block); } - + if (DEBUG_FREE_SPACE) { periodicValidateFreeSpace(); } - + this.freed += blockSize; this.memoryUsage.recordFree(poolId, blockSize); } finally { @@ -1668,7 +1668,7 @@ public class Database { /** * Interrupting the thread with {@link Thread#interrupt()} won't interrupt the write. Returns true iff an attempt * was made to interrupt the thread with {@link Thread#interrupt()}. - * + * * @throws IndexException */ private boolean flushAndUnlockChunks(final ArrayList<Chunk> dirtyChunks, boolean isComplete) throws IndexException { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IBTreeVisitor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IBTreeVisitor.java index f3c57272e..fd15faf5a 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IBTreeVisitor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IBTreeVisitor.java @@ -14,7 +14,7 @@ *******************************************************************************/ package org.eclipse.jdt.internal.core.nd.db; -/** +/** * The visitor visits all records where compare returns 0. */ public interface IBTreeVisitor { @@ -22,7 +22,7 @@ public interface IBTreeVisitor { * Compare the record against an internally held key. The comparison must be * compatible with the one used for the btree. * Used for visiting. - * + * * @param record * @return -1 if record < key, 0 if record == key, 1 if record > key * @throws IndexException @@ -35,5 +35,5 @@ public interface IBTreeVisitor { * @return <code>true</code> to continue the visit, <code>false</code> to abort it. * @throws IndexException */ - public abstract boolean visit(long record) throws IndexException; + public abstract boolean visit(long record) throws IndexException; } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IString.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IString.java index 749343000..610e39a5b 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IString.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IString.java @@ -17,8 +17,8 @@ package org.eclipse.jdt.internal.core.nd.db; /** * Interface for strings stored in the database. There is more than one string - * format. This interface hides that fact. - * + * format. This interface hides that fact. + * * @author Doug Schaefer */ public interface IString { @@ -26,7 +26,7 @@ public interface IString { * Get the offset of this IString record in the Nd */ public long getRecord(); - + // strcmp equivalents /** * Compare this IString record and the specified IString record @@ -39,7 +39,7 @@ public interface IString { * @throws IndexException */ public int compare(IString string, boolean caseSensitive) throws IndexException; - + /** * Compare this IString record and the specified String object * @param string @@ -51,7 +51,7 @@ public interface IString { * @throws IndexException */ public int compare(String string, boolean caseSensitive) throws IndexException; - + /** * Compare this IString record and the specified character array * @param chars @@ -87,7 +87,7 @@ public interface IString { * @throws IndexException */ public int compareCompatibleWithIgnoreCase(char[] chars) throws IndexException; - + /** * Compare this IString record and the specified character array * @param name the name to compare to @@ -108,7 +108,7 @@ public interface IString { * @throws IndexException */ public char[] getChars() throws IndexException; - + /** * Get an equivalent String object to this IString record<p> * <b>N.B. This method can be expensive: compare and equals can be used for @@ -117,7 +117,7 @@ public interface IString { * @throws IndexException */ public String getString() throws IndexException; - + /** * Free the associated record in the Nd * @throws IndexException diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IndexException.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IndexException.java index 5de64a632..440422250 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IndexException.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/IndexException.java @@ -39,8 +39,8 @@ public class IndexException extends RuntimeException { /** * Sets the time that the exception occurred at (in terms of the write number * from the modification log) - * - * @param writeNumber + * + * @param writeNumber */ public void setTime(long writeNumber) { this.time = writeNumber; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/MemoryStats.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/MemoryStats.java index 5e8139a5f..b672e997d 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/MemoryStats.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/MemoryStats.java @@ -206,7 +206,7 @@ public class MemoryStats { if (idx > 0 && next.poolId == 0) { break; } - + result.add(next); } return result; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/ModificationLog.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/ModificationLog.java index 2dd0ebee8..94e90fa6e 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/ModificationLog.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/db/ModificationLog.java @@ -183,7 +183,7 @@ public class ModificationLog { /** * Search for anomalies in the log and produce a reduced report - * + * * @return a log containing the most interesting results */ public MemoryAccessLog reduce(int maxWrites) { @@ -256,7 +256,7 @@ public class ModificationLog { } private static int getBufferEntriesFor(int sizeInMegs) { - long sizeOfABufferEntry = 8 + 4 + 1; // size, in bytes, of one long, one int, and one byte + long sizeOfABufferEntry = 8 + 4 + 1; // size, in bytes, of one long, one int, and one byte return (int) (sizeInMegs * 1024L * 1024L / sizeOfABufferEntry); } @@ -422,7 +422,7 @@ public class ModificationLog { long nextAddress = this.buffer0[currentPosition]; int nextArgument = this.buffer1[currentPosition]; byte nextOp = this.operation[currentPosition]; - + switch (nextOp) { case POP_OPERATION: { tags.add(getTagForId(nextArgument)); @@ -445,7 +445,7 @@ public class ModificationLog { isMatch = true; } } - + if (isMatch) { List<Tag> stack = new ArrayList<>(); stack.addAll(tags); @@ -453,7 +453,7 @@ public class ModificationLog { nextArgument, stack); operations.add(nextOperation); } - + currentWrite--; } } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/Field.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/Field.java index 17017ab29..d41a590de 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/Field.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/Field.java @@ -18,7 +18,7 @@ import org.eclipse.jdt.internal.core.nd.Nd; import org.eclipse.jdt.internal.core.nd.db.Database; /** - * Used to represent a single field of an object stored in the database. Objects + * Used to represent a single field of an object stored in the database. Objects * which store themselves in the database should store a set of static final * FieldDefinitions at the top of their class definition to indicate their memory map. * This serves as a standard way to document the memory map for such structs, provides @@ -29,7 +29,7 @@ import org.eclipse.jdt.internal.core.nd.db.Database; * manually. The get function is more convenient but allocates objects and so should * probably not be used for frequently-accessed fields or primitive types that would * end up being autoboxed unnecessarily. - * + * * @param <T> */ public final class Field<T> extends BaseField implements IDestructableField { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldList.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldList.java index 18248c898..92009a49f 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldList.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldList.java @@ -98,7 +98,7 @@ public class FieldList<T> extends BaseField implements IDestructableField { /** * Creates a new {@link FieldList} in the given struct which contains elements of the given type. The resulting list * will grow by 1 element each time it overflows. - * + * * @param ownerStruct * the struct to which the new list field will be added. Must not have had {@link StructDef#done()} * invoked on it yet. @@ -113,7 +113,7 @@ public class FieldList<T> extends BaseField implements IDestructableField { /** * Creates a new {@link FieldList} in the given struct which contains elements of the given type. The resulting list * will grow by the given number of elements each time it overflows. - * + * * @param ownerStruct * the struct to which the new list field will be added. Must not have had {@link StructDef#done()} * invoked on it yet. @@ -142,7 +142,7 @@ public class FieldList<T> extends BaseField implements IDestructableField { /** * Returns the contents of the receiver as a {@link List}. - * + * * @param nd the database to be queried. * @param address the address of the parent struct */ @@ -181,7 +181,7 @@ public class FieldList<T> extends BaseField implements IDestructableField { try { long headerStartAddress = address + this.offset; long nextBlockAddress = LAST_BLOCK_WITH_ELEMENTS.get(nd, headerStartAddress); - + // Ensure that there's at least one block long insertionBlockAddress = nextBlockAddress; if (nextBlockAddress == 0) { @@ -190,11 +190,11 @@ public class FieldList<T> extends BaseField implements IDestructableField { FIRST_BLOCK.put(nd, headerStartAddress, newBlockAddress); insertionBlockAddress = newBlockAddress; } - + // Check if there's any free space in this block int elementsInBlock = BlockHeader.ELEMENTS_IN_USE.get(nd, insertionBlockAddress); int blockSize = BlockHeader.BLOCK_SIZE.get(nd, insertionBlockAddress); - + if (elementsInBlock >= blockSize) { long nextBlock = BlockHeader.NEXT_BLOCK.get(nd, insertionBlockAddress); if (nextBlock == 0) { @@ -203,12 +203,12 @@ public class FieldList<T> extends BaseField implements IDestructableField { } LAST_BLOCK_WITH_ELEMENTS.put(nd, headerStartAddress, nextBlock); insertionBlockAddress = nextBlock; - elementsInBlock = BlockHeader.ELEMENTS_IN_USE.get(nd, insertionBlockAddress); + elementsInBlock = BlockHeader.ELEMENTS_IN_USE.get(nd, insertionBlockAddress); } - + BlockHeader.ELEMENTS_IN_USE.put(nd, insertionBlockAddress, (short) (elementsInBlock + 1)); int elementSize = getElementSize(); - + long resultAddress = insertionBlockAddress + BlockHeader.BLOCK_HEADER_BYTES + elementsInBlock * elementSize; assert ((resultAddress - Database.BLOCK_HEADER_SIZE) & (Database.BLOCK_SIZE_DELTA - 1)) == 0; return this.elementType.getFactory().create(nd, resultAddress); @@ -233,7 +233,7 @@ public class FieldList<T> extends BaseField implements IDestructableField { } long headerStartAddress = address + this.offset; long nextBlockAddress = LAST_BLOCK_WITH_ELEMENTS.get(nd, headerStartAddress); - + int maxBlockSizeThatFitsInAChunk = (int) ((MAX_BYTES_IN_A_CHUNK - BlockHeader.BLOCK_HEADER_BYTES) / getElementSize()); @@ -244,7 +244,7 @@ public class FieldList<T> extends BaseField implements IDestructableField { LAST_BLOCK_WITH_ELEMENTS.put(nd, headerStartAddress, nextBlockAddress); FIRST_BLOCK.put(nd, headerStartAddress, nextBlockAddress); } - + // Check if there's any free space in this block int remainingToAllocate = numElements; while (true) { @@ -252,12 +252,12 @@ public class FieldList<T> extends BaseField implements IDestructableField { nextBlockAddress = BlockHeader.NEXT_BLOCK.get(nd, currentBlockAddress); int elementsInUse = BlockHeader.ELEMENTS_IN_USE.get(nd, currentBlockAddress); int blockSize = BlockHeader.BLOCK_SIZE.get(nd, currentBlockAddress); - + remainingToAllocate -= (blockSize - elementsInUse); if (remainingToAllocate <= 0) { break; } - + if (nextBlockAddress == 0) { nextBlockAddress = allocateNewBlock(nd, Math.min(maxBlockSizeThatFitsInAChunk, numElements)); BlockHeader.NEXT_BLOCK.put(nd, currentBlockAddress, nextBlockAddress); @@ -302,7 +302,7 @@ public class FieldList<T> extends BaseField implements IDestructableField { short poolId = getMemoryPoolId(nd); long headerStartAddress = address + this.offset; long firstBlockAddress = FIRST_BLOCK.get(nd, headerStartAddress); - + long nextBlockAddress = firstBlockAddress; while (nextBlockAddress != 0) { long currentBlockAddress = nextBlockAddress; @@ -311,11 +311,11 @@ public class FieldList<T> extends BaseField implements IDestructableField { destructElements(nd, currentBlockAddress + BlockHeader.BLOCK_HEADER_BYTES, elementsInBlock); db.free(currentBlockAddress, poolId); } - + db.clearRange(headerStartAddress, getRecordSize()); } finally { db.getLog().end(this.destructTag); - } + } } private void destructElements(Nd nd, long nextElementAddress, int count) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldManyToOne.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldManyToOne.java index 329183370..ad10962b5 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldManyToOne.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldManyToOne.java @@ -91,7 +91,7 @@ public class FieldManyToOne<T extends INdStruct> extends BaseField implements ID /** * Creates a many-to-one pointer which points to this object's owner. If the pointer is non-null when the owner is * deleted, this object will be deleted too. - * + * * @param builder the struct to which the field will be added * @param forwardPointer the field which holds the pointer in the other direction * @return a newly constructed field @@ -105,7 +105,7 @@ public class FieldManyToOne<T extends INdStruct> extends BaseField implements ID if (!NdNode.class.isAssignableFrom(builder.getStructClass())) { throw new IllegalArgumentException(FieldManyToOne.class.getSimpleName() + " can't be the owner of " //$NON-NLS-1$ + builder.getStructClass().getSimpleName() + " because the latter isn't a subclass of " //$NON-NLS-1$ - + NdNode.class.getSimpleName()); + + NdNode.class.getSimpleName()); } FieldManyToOne<T> result = new FieldManyToOne<T>(builder, forwardPointer, true); @@ -117,7 +117,7 @@ public class FieldManyToOne<T extends INdStruct> extends BaseField implements ID /** * Sets whether or not this field permits nulls to be assigned. - * + * * @param permitted true iff the field permits nulls * @return this */ @@ -163,14 +163,14 @@ public class FieldManyToOne<T extends INdStruct> extends BaseField implements ID throw new IllegalStateException( getClass().getSimpleName() + " must be associated with a " + FieldOneToMany.class.getSimpleName()); //$NON-NLS-1$ } - + long oldTargetAddress = TARGET.get(nd, fieldStart); if (oldTargetAddress == newTargetAddress) { return; } - + detachFromOldTarget(nd, address, oldTargetAddress); - + TARGET.put(nd, fieldStart, newTargetAddress); if (newTargetAddress != 0) { // Note that newValue is the address of the backpointer list and record (the address of the struct @@ -197,7 +197,7 @@ public class FieldManyToOne<T extends INdStruct> extends BaseField implements ID short targetTypeId = NdNode.NODE_TYPE.get(nd, oldTargetAddress); ITypeFactory<? extends NdNode> typeFactory = nd.getTypeFactory(targetTypeId); - if (typeFactory.getDeletionSemantics() == StructDef.DeletionSemantics.REFCOUNTED + if (typeFactory.getDeletionSemantics() == StructDef.DeletionSemantics.REFCOUNTED && typeFactory.isReadyForDeletion(nd, oldTargetAddress)) { nd.scheduleDeletion(oldTargetAddress); } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldOneToMany.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldOneToMany.java index 6b1a860c1..919cb0be8 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldOneToMany.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldOneToMany.java @@ -58,8 +58,8 @@ public class FieldOneToMany<T extends INdStruct> extends BaseField implements ID /** * Creates a {@link FieldOneToMany} using the given builder. It will hold the many side of a one-to-many - * relationship with nodeType. - * + * relationship with nodeType. + * * @param builder builder that is being used to construct the struct containing this field * @param forwardPointer field of the model object which holds the one side of this one-to-many relationship * @param inlineElementCount number of inline elements. If this is nonzero, space for this number elements is @@ -68,7 +68,7 @@ public class FieldOneToMany<T extends INdStruct> extends BaseField implements ID * offer a performance improvement. For relationships that will normally be empty, this should be 0. * @return the newly constructed backpointer field */ - public static <T extends INdStruct, B extends INdStruct> FieldOneToMany<T> create(StructDef<B> builder, + public static <T extends INdStruct, B extends INdStruct> FieldOneToMany<T> create(StructDef<B> builder, FieldManyToOne<B> forwardPointer, int inlineElementCount) { FieldOneToMany<T> result = new FieldOneToMany<T>(builder, forwardPointer, inlineElementCount); builder.add(result); @@ -77,7 +77,7 @@ public class FieldOneToMany<T extends INdStruct> extends BaseField implements ID return result; } - public static <T extends INdStruct, B extends INdStruct> FieldOneToMany<T> create(StructDef<B> builder, + public static <T extends INdStruct, B extends INdStruct> FieldOneToMany<T> create(StructDef<B> builder, FieldManyToOne<B> forwardPointer) { return create(builder, forwardPointer, 0); } @@ -106,7 +106,7 @@ public class FieldOneToMany<T extends INdStruct> extends BaseField implements ID public boolean isEmpty(Nd nd, long address) { return this.backPointerArray.isEmpty(nd, address + this.offset); } - + public int size(Nd nd, long address) { return this.backPointerArray.size(nd, address + this.offset); } @@ -146,7 +146,7 @@ public class FieldOneToMany<T extends INdStruct> extends BaseField implements ID } /** - * Returns the record size of the back pointer list + * Returns the record size of the back pointer list */ @Override public int getRecordSize() { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldOneToOne.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldOneToOne.java index 20313f159..6695fcd2f 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldOneToOne.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldOneToOne.java @@ -24,7 +24,7 @@ import org.eclipse.jdt.internal.core.nd.db.Database; * Represents a 1-to-0..1 relationship in a Nd database. */ public class FieldOneToOne<T extends INdStruct> extends BaseField implements IDestructableField, IRefCountedField { - public final StructDef<T> nodeType; + public final StructDef<T> nodeType; FieldOneToOne<?> backPointer; private boolean pointsToOwner; private final Tag putTag; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldSearchIndex.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldSearchIndex.java index 2b6aaeb5f..1fd37f805 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldSearchIndex.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/FieldSearchIndex.java @@ -41,7 +41,7 @@ public class FieldSearchIndex<T extends NdNode> extends BaseField implements IDe return 1; } }; - + public static final class SearchCriteria { private boolean matchCase = true; private boolean isPrefix = false; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/IRefCountedField.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/IRefCountedField.java index 8abca7f28..fbe8afb9b 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/IRefCountedField.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/IRefCountedField.java @@ -23,6 +23,6 @@ public interface IRefCountedField { * <p> * Implementations should return false if the refcount is 0 or true if the refcount * is nonzero. - */ + */ public boolean hasReferences(Nd nd, long address); } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/StructDef.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/StructDef.java index 5e5b658f2..ec9ebf6ed 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/StructDef.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/field/StructDef.java @@ -137,7 +137,7 @@ public final class StructDef<T> { @Override public boolean hasDestructor() { - return StructDef.this.hasUserDestructor || hasDestructableFields(); + return StructDef.this.hasUserDestructor || hasDestructableFields(); } @Override @@ -170,7 +170,7 @@ public final class StructDef<T> { public boolean isReadyForDeletion(Nd dom, long address) { return StructDef.this.isReadyForDeletion(dom, address); } - + @Override public DeletionSemantics getDeletionSemantics() { return StructDef.this.getDeletionSemantics(); @@ -251,7 +251,7 @@ public final class StructDef<T> { } protected boolean hasDestructableFields() { - return (!StructDef.this.destructableFields.isEmpty() || + return (!StructDef.this.destructableFields.isEmpty() || (StructDef.this.superClass != null && StructDef.this.superClass.hasDestructableFields())); } @@ -369,7 +369,7 @@ public final class StructDef<T> { + "that uses " + this.superClass.deletionSemantics.toString() + " semantics"); //$NON-NLS-1$//$NON-NLS-2$ } } - + this.offsetsComputed = true; for (StructDef<? extends T> next : this.dependents) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/ClassFileToIndexConverter.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/ClassFileToIndexConverter.java index c57f39917..3271fdc0f 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/ClassFileToIndexConverter.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/ClassFileToIndexConverter.java @@ -107,8 +107,8 @@ public final class ClassFileToIndexConverter { } /** - * Adds a type to the index, given an input class file and a binary name. Note that the given binary name is - * + * Adds a type to the index, given an input class file and a binary name. Note that the given binary name is + * * @param binaryType an object used for parsing the .class file itself * @param fieldDescriptor the name that is used to locate the class, computed from the .class file's name and location. * In the event that the .class file has been moved, this may differ from the binary name stored in the .class file @@ -350,15 +350,15 @@ public final class ClassFileToIndexConverter { int numArgumentsInGenericSignature = countMethodArguments(signature); int numCompilerDefinedParameters = Math.max(0, parameterFieldDescriptors.size() - numArgumentsInGenericSignature); - + boolean compilerDefinedParametersAreIncludedInSignature = (next.getGenericSignature() == null); // If there is no generic signature, then fall back to heuristics based on what we know about // where the java compiler likes to create compiler-defined arguments if (compilerDefinedParametersAreIncludedInSignature) { // Constructors for non-static member types get a compiler-defined first argument - if (binaryType.isMember() - && next.isConstructor() + if (binaryType.isMember() + && next.isConstructor() && ((binaryType.getModifiers() & Modifier.STATIC) == 0) && parameterFieldDescriptors.size() > 0) { @@ -483,7 +483,7 @@ public final class ClassFileToIndexConverter { variable.allocateTypeAnnotations(typeAnnotations.length); for (IBinaryTypeAnnotation next : typeAnnotations) { NdTypeAnnotation annotation = variable.createTypeAnnotation(); - + initTypeAnnotation(annotation, next); } } @@ -844,7 +844,7 @@ public final class ClassFileToIndexConverter { case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER: case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER: annotation.setTargetInfo(next.getTypeParameterIndex()); - break; + break; case AnnotationTargetTypeConstants.CLASS_EXTENDS: annotation.setTargetInfo(next.getSupertypeIndex()); break; @@ -870,7 +870,7 @@ public final class ClassFileToIndexConverter { } private void initAnnotation(NdAnnotation annotation, IBinaryAnnotation next) { - annotation.setType(createTypeIdFromBinaryName(next.getTypeName())); + annotation.setType(createTypeIdFromBinaryName(next.getTypeName())); IBinaryElementValuePair[] pairs = next.getElementValuePairs(); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/FileStateCache.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/FileStateCache.java index 0bfae703b..30228d5cf 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/FileStateCache.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/FileStateCache.java @@ -57,7 +57,7 @@ public class FileStateCache { /** * Inserts a new entry into the cache. - * + * * @param location absolute filesystem path to the file * @param result true if the file is definitely in sync with the index, false if there is any possibility of it * being out of sync. @@ -79,7 +79,7 @@ public class FileStateCache { /** * Removes a single entry from the cache. - * + * * @param location absolute filesystem path to the file. */ public void remove(String location) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/Indexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/Indexer.java index 621e104c3..fd5c1ff46 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/Indexer.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/Indexer.java @@ -97,7 +97,7 @@ public final class Indexer { public static boolean DEBUG_INSERTIONS; public static boolean DEBUG_SELFTEST; public static int DEBUG_LOG_SIZE_MB; - + // New index is disabled, see bug 544898 // private static final String ENABLE_NEW_JAVA_INDEX = "enableNewJavaIndex"; //$NON-NLS-1$ // private static IPreferenceChangeListener listener = new IPreferenceChangeListener() { @@ -181,7 +181,7 @@ public final class Indexer { * when running the unit tests, since indexing will not occur unless it is triggered * explicitly. * <p> - * Synchronize on {@link #automaticIndexingMutex} before accessing. + * Synchronize on {@link #automaticIndexingMutex} before accessing. */ public void enableAutomaticIndexing(boolean enabled) { boolean runRescan = false; @@ -200,7 +200,7 @@ public final class Indexer { // Force a rescan when re-enabling automatic indexing since we may have missed an update this.rescanJob.schedule(); } - + if (!enabled) { // Wait for any existing indexing operations to finish when disabling automatic indexing since // we only want explicitly-triggered indexing operations to run after the method returns @@ -471,7 +471,7 @@ public final class Indexer { private int cleanGarbage(long currentTimeMillis, Collection<IPath> allIndexables, IProgressMonitor monitor) { JavaIndex index = JavaIndex.getIndex(this.nd); - int result = 0; + int result = 0; HashSet<IPath> paths = new HashSet<>(); paths.addAll(allIndexables); SubMonitor subMonitor = SubMonitor.convert(monitor, 3); @@ -555,7 +555,7 @@ public final class Indexer { if (!toDelete.isInIndex()) { break; } - + int numChildren = toDelete.getTypeCount(); deletionMonitor.setWorkRemaining(numChildren + 1); if (numChildren == 0) { @@ -1080,7 +1080,7 @@ public final class Indexer { /** * Dirties the given filesystem location. This must point to a single file (not a folder) that needs to be * rescanned. The file may have been added, removed, or changed. - * + * * @param location an absolute filesystem location */ public void makeDirty(IPath location) { @@ -1100,7 +1100,7 @@ public final class Indexer { * Schedules a rescan of the given path (which may be either a workspace path or an absolute path on the local * filesystem). This may point to either a single file or a folder that needs to be rescanned. Any resource that * has this path as a prefix will be rescanned. - * + * * @param pathToRescan */ public void makeWorkspacePathDirty(IPath pathToRescan) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/WorkspaceSnapshot.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/WorkspaceSnapshot.java index 5b0400502..69cf4f71f 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/WorkspaceSnapshot.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/WorkspaceSnapshot.java @@ -154,11 +154,11 @@ public final class WorkspaceSnapshot { IPath defaultOutputLocation = javaProject.getOutputLocation(); for (IClasspathEntry next : entries) { IPath nextOutputLocation = next.getOutputLocation(); - + if (nextOutputLocation == null) { nextOutputLocation = defaultOutputLocation; } - + IResource resource = root.findMember(nextOutputLocation); if (resource != null) { resourcesToScan.add(resource); @@ -198,7 +198,7 @@ public final class WorkspaceSnapshot { return allIndexables; } - private static void collectAllClassFiles(IWorkspaceRoot root, List<? super IClassFile> result, + private static void collectAllClassFiles(IWorkspaceRoot root, List<? super IClassFile> result, Collection<? extends IResource> toScan, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/FileFingerprint.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/FileFingerprint.java index 1f5f3dd34..5ce5c1cf3 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/FileFingerprint.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/FileFingerprint.java @@ -143,7 +143,7 @@ public class FileFingerprint { /** * Returns true iff the file existed at the time the fingerprint was computed. - * + * * @return true iff the file existed at the time the fingerprint was computed. */ public boolean fileExists() { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/JavaIndex.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/JavaIndex.java index afef5b891..e0445146a 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/JavaIndex.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/JavaIndex.java @@ -99,9 +99,9 @@ public class JavaIndex { /** * Returns true iff the given resource file is up-to-date with the filesystem. Returns false * if the argument is null or there is a possibility it being out-of-date with the file system. - * + * * @param file the index file to look up or null - * @throws CoreException + * @throws CoreException */ public boolean isUpToDate(NdResourceFile file) throws CoreException { if (file != null && file.isDoneIndexing()) { @@ -219,7 +219,7 @@ public class JavaIndex { } /** - * @return always return {@code false} see bug 544898. New index is disabled now. + * @return always return {@code false} see bug 544898. New index is disabled now. */ public static boolean isEnabled() { return false; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/JavaNames.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/JavaNames.java index 391982512..ffc81c1af 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/JavaNames.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/JavaNames.java @@ -105,7 +105,7 @@ public class JavaNames { char[] className = CharArrayUtils.subarray(fieldDescriptor, separatorPosition + 1, fieldDescriptor.length - 1); return className; } - + /** * Converts a field descriptor to a java name. If fullyQualified is true, it returns a fully qualified class name. * If it is false, it returns a source name. diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdMethod.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdMethod.java index 055386f51..90dc09720 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdMethod.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdMethod.java @@ -235,7 +235,7 @@ public class NdMethod extends NdBinding { /** * Creates the {@link NdMethodAnnotationData} struct for this method if it does not already exist. Returns - * the existing or newly-created struct. + * the existing or newly-created struct. */ public NdMethodAnnotationData createAnnotationData() { NdMethodAnnotationData result = getAnnotationData(); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdResourceFile.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdResourceFile.java index 7dbac48b6..7accb29db 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdResourceFile.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdResourceFile.java @@ -79,7 +79,7 @@ public class NdResourceFile extends NdNode { type.done(); } - private long jdkLevel; + private long jdkLevel; public NdResourceFile(Nd dom, long address) { super(dom, address); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdTypeInterface.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdTypeInterface.java index 25aefe094..e1df69ea0 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdTypeInterface.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/NdTypeInterface.java @@ -36,7 +36,7 @@ public class NdTypeInterface extends NdNode { IMPLEMENTS = FieldManyToOne.create(type, NdTypeSignature.IMPLEMENTATIONS); type.done(); } - + public NdTypeInterface(Nd nd, long address) { super(nd, address); } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryModuleDescriptor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryModuleDescriptor.java index de74b4afe..03a6e63af 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryModuleDescriptor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryModuleDescriptor.java @@ -28,7 +28,7 @@ public class BinaryModuleDescriptor { /** * Constructs a new descriptor - * + * * @param location * location where the archive (.jar or .class) can be found in the local filesystem * @param moduleName diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryModuleFactory.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryModuleFactory.java index 95342d8fd..0733edb72 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryModuleFactory.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryModuleFactory.java @@ -86,8 +86,8 @@ public class BinaryModuleFactory { * the file on disk, the type is read from the index. Otherwise the type is read from disk. Returns null if * no such type exists. * <strong>caveat</strong> modules are not yet supported in the index. - * - * @throws ClassFormatException + * + * @throws ClassFormatException */ public static IBinaryModule readModule(BinaryModuleDescriptor descriptor, IProgressMonitor monitor) throws JavaModelException, ClassFormatException { // FIXME: support module in the new index @@ -100,7 +100,7 @@ public class BinaryModuleFactory { // } return rawReadModule(descriptor, true); } - + public static IBinaryModule rawReadModule(BinaryModuleDescriptor descriptor, boolean fullyInitialize) throws JavaModelException, ClassFormatException { try { return rawReadModuleTestForExists(descriptor, fullyInitialize, true); @@ -112,7 +112,7 @@ public class BinaryModuleFactory { /** * Read the class file from disk, circumventing the index's cache. This should only be used by callers * that need to read information from the class file which aren't present in the index (such as method bodies). - * + * * @return the newly-created IBinaryModule or null if the given class file does not exist. * @throws ClassFormatException if the class file existed but was corrupt * @throws JavaModelException if unable to read the class file due to a transient failure diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryTypeDescriptor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryTypeDescriptor.java index 1b1ae6a58..737ef1ce9 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryTypeDescriptor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryTypeDescriptor.java @@ -28,7 +28,7 @@ public final class BinaryTypeDescriptor { /** * Constructs a new descriptor - * + * * @param location * location where the archive (.jar or .class) can be found in the local filesystem * @param fieldDescriptor diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryTypeFactory.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryTypeFactory.java index 2f31849f5..f046d3e0d 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryTypeFactory.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryTypeFactory.java @@ -121,7 +121,7 @@ public class BinaryTypeFactory { * Reads the given binary type. If the type can be found in the index with a fingerprint that exactly matches * the file on disk, the type is read from the index. Otherwise the type is read from disk. Returns null if * no such type exists. - * @throws ClassFormatException + * @throws ClassFormatException */ public static IBinaryType readType(BinaryTypeDescriptor descriptor, IProgressMonitor monitor) throws JavaModelException, ClassFormatException { @@ -147,7 +147,7 @@ public class BinaryTypeFactory { /** * Read the class file from disk, circumventing the index's cache. This should only be used by callers * that need to read information from the class file which aren't present in the index (such as method bodies). - * + * * @return the newly-created ClassFileReader or null if the given class file does not exist. * @throws ClassFormatException if the class file existed but was corrupt * @throws JavaModelException if unable to read the class file due to a transient failure @@ -210,7 +210,7 @@ public class BinaryTypeFactory { * able to determine that the requested class does not exist in that file. */ public static IBinaryType readFromIndex(JavaIndex index, BinaryTypeDescriptor descriptor, IProgressMonitor monitor) throws JavaModelException, NotInIndexException { - // If the new index is enabled, check if we have this class file cached in the index already + // If the new index is enabled, check if we have this class file cached in the index already char[] fieldDescriptor = descriptor.fieldDescriptor; Nd nd = index.getNd(); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/IndexBinaryType.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/IndexBinaryType.java index 37a158415..1f36ec219 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/IndexBinaryType.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/IndexBinaryType.java @@ -466,7 +466,7 @@ public class IndexBinaryType implements IBinaryType { method.getGenericSignature(result, method.hasAllFlags(NdMethod.FLG_THROWS_SIGNATURE_PRESENT)); return result.getContents(); } - + private char[][] getArgumentNames(NdMethod ndMethod) { // Unlike what its JavaDoc says, IBinaryType returns an empty array if no argument names are available, so // we replicate this weird undocumented corner case here. diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/util/CharArrayUtils.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/util/CharArrayUtils.java index f84f0ea34..e36093ec6 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/util/CharArrayUtils.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/util/CharArrayUtils.java @@ -97,7 +97,7 @@ public class CharArrayUtils { /** * Returns {@code true} if the contents of a section of a character array are the same as contents of a string. - * + * * @since 5.5 */ public static final boolean equals(char[] str1, int start1, int length1, String str2) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/util/PathMap.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/util/PathMap.java index b5c57115c..e1ecc4dcc 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/util/PathMap.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/util/PathMap.java @@ -100,7 +100,7 @@ public class PathMap<T> { if (this.children == null) { return; } - + for (Entry<String, Node<T>> next : this.children.entrySet()) { String key = next.getKey(); IPath nextPath = buildChildPath(parent, key); @@ -112,7 +112,7 @@ public class PathMap<T> { IPath nextPath = parent.append(key); return nextPath; } - + public void toString(StringBuilder builder, IPath parentPath) { if (this.exists) { builder.append("["); //$NON-NLS-1$ @@ -121,7 +121,7 @@ public class PathMap<T> { builder.append(this.value); builder.append("\n"); //$NON-NLS-1$ } - if (this.children != null) { + if (this.children != null) { for (Entry<String, Node<T>> next : this.children.entrySet()) { String key = next.getKey(); IPath nextPath = buildChildPath(parentPath, key); @@ -165,7 +165,7 @@ public class PathMap<T> { nextPath.setDevice(key); return nextPath; } - + @Override public void toString(StringBuilder builder, IPath parentPath) { this.noDevice.toString(builder, parentPath); @@ -226,7 +226,7 @@ public class PathMap<T> { @Override public String toString() { StringBuilder builder = new StringBuilder(); - + this.root.toString(builder, Path.EMPTY); return builder.toString(); } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/AbstractJavaSearchScope.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/AbstractJavaSearchScope.java index 888fe83a9..4c46d8c55 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/AbstractJavaSearchScope.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/AbstractJavaSearchScope.java @@ -29,7 +29,7 @@ abstract public AccessRuleSet getAccessRuleSet(String relativePath, String conta /** * Returns the package fragment root corresponding to a given resource path. - * + * * @param resourcePathString path of expected package fragment root. * @param jarSeparatorIndex the index of the jar separator in the resource path, or -1 if none * @param jarPath the already extracted jar path, or null if none diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java index 50e94c77e..5515ce636 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java @@ -146,7 +146,7 @@ public class BasicSearchEngine { } return createJavaSearchScope(excludeTestCode, elements, includeMask); } - + public static IJavaSearchScope createJavaSearchScope(IJavaElement[] elements, int includeMask) { return createJavaSearchScope(false, elements, includeMask); } @@ -490,7 +490,7 @@ public class BasicSearchEngine { boolean isPkgCaseSensitive = (matchRulePkg & SearchPattern.R_CASE_SENSITIVE) != 0; if (patternPkg != null && !CharOperation.equals(patternPkg, pkg, isPkgCaseSensitive)) return false; - + boolean isCaseSensitive = (matchRuleType & SearchPattern.R_CASE_SENSITIVE) != 0; if (patternTypeName != null) { boolean isCamelCase = (matchRuleType & (SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH)) != 0; @@ -548,28 +548,28 @@ public class BasicSearchEngine { return matchFirstChar && CharOperation.camelCaseMatch(patternName, name, true); } } - return true; + return true; } - boolean match(char[] patternPkg, int matchRulePkg, + boolean match(char[] patternPkg, int matchRulePkg, char[] patternDeclaringQualifier, int matchRuleDeclaringQualifier, char[] patternDeclaringSimpleName, int matchRuleDeclaringSimpleName, - char[] patternMethodName, int methodMatchRule, + char[] patternMethodName, int methodMatchRule, char[] packageName, char[] declaringQualifier, char[] declaringSimpleName, char[] methodName) { - + if (patternPkg != null && !CharOperation.equals(patternPkg, packageName, (matchRulePkg & SearchPattern.R_CASE_SENSITIVE) != 0)) return false; - + return match(patternDeclaringQualifier, matchRuleDeclaringQualifier, declaringQualifier) && match(patternDeclaringSimpleName, matchRuleDeclaringSimpleName, declaringSimpleName) && match(patternMethodName, methodMatchRule, methodName); - + } - - boolean match(char[] patternFusedQualifier, int matchRuleFusedQualifier, - char[] patternMethodName, int methodMatchRule, + + boolean match(char[] patternFusedQualifier, int matchRuleFusedQualifier, + char[] patternMethodName, int methodMatchRule, char[] packageName, char[] declaringQualifier, char[] declaringSimpleName, char[] methodName) { - + char[] q = packageName != null ? packageName : CharOperation.NO_CHAR; if (declaringQualifier != null && declaringQualifier.length > 0) { q = q.length > 0 ? CharOperation.concat(q, declaringQualifier, '.') : declaringQualifier; @@ -577,10 +577,10 @@ public class BasicSearchEngine { if (declaringSimpleName != null && declaringSimpleName.length > 0) { q = q.length > 0 ? CharOperation.concat(q, declaringSimpleName, '.') : declaringSimpleName; } - + return match(patternFusedQualifier, matchRuleFusedQualifier, q) && match(patternMethodName, methodMatchRule, methodName); - + } /** * Searches for matches of a given search pattern. Search patterns can be created using helper @@ -596,7 +596,7 @@ public class BasicSearchEngine { } findMatches(pattern, participants, scope, requestor, monitor); } - + public void searchAllConstructorDeclarations( final char[] packageName, final char[] typeName, @@ -609,10 +609,10 @@ public class BasicSearchEngine { try { // Validate match rule first final int validatedTypeMatchRule = SearchPattern.validateMatchRule(typeName == null ? null : new String (typeName), typeMatchRule); - + final int pkgMatchRule = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE; final char NoSuffix = IIndexConstants.TYPE_SUFFIX; // Used as TYPE_SUFFIX has no effect in method #match(char, char[] , int, char[], int , int, char[], char[]) - + // Debug if (VERBOSE) { Util.verbose("BasicSearchEngine.searchAllConstructorDeclarations(char[], char[], int, IJavaSearchScope, IRestrictedAccessConstructorRequestor, int, IProgressMonitor)"); //$NON-NLS-1$ @@ -625,14 +625,14 @@ public class BasicSearchEngine { Util.verbose(" - scope: "+scope); //$NON-NLS-1$ } if (validatedTypeMatchRule == -1) return; // invalid match rule => return no results - + // Create pattern IndexManager indexManager = JavaModelManager.getIndexManager(); final ConstructorDeclarationPattern pattern = new ConstructorDeclarationPattern( packageName, typeName, validatedTypeMatchRule); - + // Get working copy path(s). Store in a single string in case of only one to optimize comparison in requestor final HashSet workingCopyPaths = new HashSet(); String workingCopyPath = null; @@ -649,14 +649,14 @@ public class BasicSearchEngine { } } final String singleWkcpPath = workingCopyPath; - + // Index requestor IndexQueryRequestor searchRequestor = new IndexQueryRequestor(){ @Override public boolean acceptIndexMatch(String documentPath, SearchPattern indexRecord, SearchParticipant participant, AccessRuleSet access) { // Filter unexpected types ConstructorDeclarationPattern record = (ConstructorDeclarationPattern)indexRecord; - + if ((record.extraFlags & ExtraFlags.IsMemberType) != 0) { return true; // filter out member classes } @@ -677,7 +677,7 @@ public class BasicSearchEngine { } break; } - + // Accept document path AccessRestriction accessRestriction = null; if (access != null) { @@ -716,7 +716,7 @@ public class BasicSearchEngine { return true; } }; - + SubMonitor subMonitor = SubMonitor.convert(progressMonitor, Messages.engine_searching, 1000); // add type names from indexes indexManager.performConcurrentJob( @@ -727,7 +727,7 @@ public class BasicSearchEngine { searchRequestor), waitingPolicy, subMonitor.split(Math.max(1000-copiesLength, 0))); - + // add type names from working copies if (copies != null) { for (int i = 0; i < copiesLength; i++) { @@ -738,7 +738,7 @@ public class BasicSearchEngine { } else { if (!scope.encloses(workingCopy)) continue; } - + final String path = workingCopy.getPath().toString(); if (workingCopy.isConsistent()) { IPackageDeclaration[] packageDeclarations = workingCopy.getPackageDeclarations(); @@ -748,17 +748,17 @@ public class BasicSearchEngine { IType type = allTypes[j]; char[] simpleName = type.getElementName().toCharArray(); if (match(NoSuffix, packageName, pkgMatchRule, typeName, validatedTypeMatchRule, 0/*no kind*/, packageDeclaration, simpleName) && !type.isMember()) { - + int extraFlags = ExtraFlags.getExtraFlags(type); - + boolean hasConstructor = false; - + IMethod[] methods = type.getMethods(); for (int k = 0; k < methods.length; k++) { IMethod method = methods[k]; if (method.isConstructor()) { hasConstructor = true; - + String[] stringParameterNames = method.getParameterNames(); String[] stringParameterTypes = method.getParameterTypes(); int length = stringParameterNames.length; @@ -768,13 +768,13 @@ public class BasicSearchEngine { parameterNames[l] = stringParameterNames[l].toCharArray(); parameterTypes[l] = Signature.toCharArray(Signature.getTypeErasure(stringParameterTypes[l]).toCharArray()); } - + nameRequestor.acceptConstructor( method.getFlags(), simpleName, parameterNames.length, null,// signature is not used for source type - parameterTypes, + parameterTypes, parameterNames, type.getFlags(), packageDeclaration, @@ -783,7 +783,7 @@ public class BasicSearchEngine { null); } } - + if (!hasConstructor) { nameRequestor.acceptConstructor( Flags.AccPublic, @@ -810,10 +810,10 @@ public class BasicSearchEngine { class AllConstructorDeclarationsVisitor extends ASTVisitor { private TypeDeclaration[] declaringTypes = new TypeDeclaration[0]; private int declaringTypesPtr = -1; - + private void endVisit(TypeDeclaration typeDeclaration) { if (!hasConstructor(typeDeclaration) && typeDeclaration.enclosingType == null) { - + if (match(NoSuffix, packageName, pkgMatchRule, typeName, validatedTypeMatchRule, 0/*no kind*/, packageDeclaration, typeDeclaration.name)) { nameRequestor.acceptConstructor( Flags.AccPublic, @@ -829,21 +829,21 @@ public class BasicSearchEngine { null); } } - + this.declaringTypes[this.declaringTypesPtr] = null; this.declaringTypesPtr--; } - + @Override public void endVisit(TypeDeclaration typeDeclaration, CompilationUnitScope s) { endVisit(typeDeclaration); } - + @Override public void endVisit(TypeDeclaration memberTypeDeclaration, ClassScope s) { endVisit(memberTypeDeclaration); } - + private boolean hasConstructor(TypeDeclaration typeDeclaration) { AbstractMethodDeclaration[] methods = typeDeclaration.methods; int length = methods == null ? 0 : methods.length; @@ -852,7 +852,7 @@ public class BasicSearchEngine { return true; } } - + return false; } @Override @@ -876,7 +876,7 @@ public class BasicSearchEngine { parameterTypes[l] = CharOperation.concatWith(((QualifiedTypeReference)argument.type).tokens, '.'); } } - + TypeDeclaration enclosing = typeDeclaration.enclosingType; char[][] enclosingTypeNames = CharOperation.NO_CHAR_CHAR; while (enclosing != null) { @@ -887,7 +887,7 @@ public class BasicSearchEngine { enclosing = null; } } - + nameRequestor.acceptConstructor( constructorDeclaration.modifiers, typeName, @@ -905,9 +905,9 @@ public class BasicSearchEngine { } @Override public boolean visit(TypeDeclaration typeDeclaration, BlockScope blockScope) { - return false; + return false; } - + private boolean visit(TypeDeclaration typeDeclaration) { if(this.declaringTypes.length <= ++this.declaringTypesPtr) { int length = this.declaringTypesPtr; @@ -916,12 +916,12 @@ public class BasicSearchEngine { this.declaringTypes[this.declaringTypesPtr] = typeDeclaration; return true; } - + @Override public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope s) { return visit(typeDeclaration); } - + @Override public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope s) { return visit(memberTypeDeclaration); @@ -940,12 +940,12 @@ public class BasicSearchEngine { } /** - * Searches for all method declarations in the given scope. + * Searches for all method declarations in the given scope. * * <p> * Warning: This API is in experimental phase and may be modified/removed. Do not use this until this * comment is removed. * </p> - * + * * @see SearchEngine#searchAllMethodNames(char[], int, char[], int, IJavaSearchScope, MethodNameMatchRequestor, int, IProgressMonitor) * for detailed comments */ @@ -1001,7 +1001,7 @@ public class BasicSearchEngine { @Override public boolean acceptIndexMatch(String documentPath, SearchPattern indexRecord, SearchParticipant participant, AccessRuleSet access) { MethodDeclarationPattern record = (MethodDeclarationPattern)indexRecord; - + if ((record.extraFlags & ExtraFlags.IsLocalType) != 0) { return true; // filter out local and anonymous classes } @@ -1047,21 +1047,21 @@ public class BasicSearchEngine { accessRestriction = access.getViolatedRestriction(path); } } - if (match(qualifier, qualifierMatchRule, methodName, methodMatchRule, + if (match(qualifier, qualifierMatchRule, methodName, methodMatchRule, record.declaringPackageName, record.declaringQualification, record.declaringSimpleName, record.selector)) { nameRequestor.acceptMethod( - record.selector, + record.selector, record.parameterCount, record.declaringQualification, - record.declaringSimpleName, - record.declaringTypeModifiers, + record.declaringSimpleName, + record.declaringTypeModifiers, record.declaringPackageName, - record.signature, - record.parameterTypes, + record.signature, + record.parameterTypes, record.parameterNames, record.returnSimpleName, - record.modifiers, - documentPath, + record.modifiers, + documentPath, accessRestriction, -1 /* method index not applicable as there is no IType here */); } @@ -1095,7 +1095,7 @@ public class BasicSearchEngine { if (workingCopy.isConsistent()) { IPackageDeclaration[] packageDeclarations = workingCopy.getPackageDeclarations(); char[] packageDeclaration = packageDeclarations.length == 0 ? CharOperation.NO_CHAR : packageDeclarations[0].getElementName().toCharArray(); - + IType[] allTypes = workingCopy.getAllTypes(); for (int j = 0, allTypesLength = allTypes.length; j < allTypesLength; j++) { IType type = allTypes[j]; @@ -1106,7 +1106,7 @@ public class BasicSearchEngine { if (!match(qualifier, qualifierMatchRule, q)) continue; reportMatchingMethods(methodName, methodMatchRule, nameRequestor, path, - packageDeclaration, type, rDeclaringQualification, rSimpleName); + packageDeclaration, type, rDeclaringQualification, rSimpleName); } } else { Parser basicParser = getParser(); @@ -1122,7 +1122,7 @@ public class BasicSearchEngine { public IType type; public boolean visitMethods; public char[] enclosingTypeName; - + TypeInfo(TypeDeclaration typeDecl, boolean visitMethods, char[] enclosingTypeName) { this.typeDecl = typeDecl; this.type = workingCopy.getType(new String(typeDecl.name)); @@ -1170,13 +1170,13 @@ public class BasicSearchEngine { if (typeInfo.visitMethods && match(methodName, methodMatchRule, methodDeclaration.selector)) { reportMatchingMethod(path, packageDeclaration, - typeInfo.enclosingTypeName, - typeInfo.typeDecl, + typeInfo.enclosingTypeName, + typeInfo.typeDecl, methodDeclaration, getCurrentType(), nameRequestor); } - + return false; // no need to find methods from local/anonymous type } @Override @@ -1204,12 +1204,12 @@ public class BasicSearchEngine { } /** - * Searches for all method declarations in the given scope. + * Searches for all method declarations in the given scope. * * <p> * Warning: This API is in experimental phase and may be modified/removed. Do not use this until this * comment is removed. * </p> - * + * * @see SearchEngine#searchAllMethodNames(char[], int, char[], int, char[], int, char[], int, IJavaSearchScope, MethodNameMatchRequestor, int, IProgressMonitor) * for detailed comments */ @@ -1271,7 +1271,7 @@ public class BasicSearchEngine { @Override public boolean acceptIndexMatch(String documentPath, SearchPattern indexRecord, SearchParticipant participant, AccessRuleSet access) { MethodDeclarationPattern record = (MethodDeclarationPattern)indexRecord; - + if ((record.extraFlags & ExtraFlags.IsLocalType) != 0) { return true; // filter out local and anonymous classes } @@ -1317,21 +1317,21 @@ public class BasicSearchEngine { accessRestriction = access.getViolatedRestriction(path); } } - if (match(packageName, pkgMatchRule, declaringQualification, declQualificationMatchRule, declaringSimpleName, declSimpleNameMatchRule, methodName, methodMatchRule, + if (match(packageName, pkgMatchRule, declaringQualification, declQualificationMatchRule, declaringSimpleName, declSimpleNameMatchRule, methodName, methodMatchRule, record.declaringPackageName, record.declaringQualification, record.declaringSimpleName, record.selector)) { nameRequestor.acceptMethod( - record.selector, + record.selector, record.parameterCount, record.declaringQualification, - record.declaringSimpleName, - record.declaringTypeModifiers, + record.declaringSimpleName, + record.declaringTypeModifiers, record.declaringPackageName, - record.signature, - record.parameterTypes, + record.signature, + record.parameterTypes, record.parameterNames, record.returnSimpleName, - record.modifiers, - documentPath, + record.modifiers, + documentPath, accessRestriction, -1 /* method index not applicable as there is no IType here */); } @@ -1352,7 +1352,7 @@ public class BasicSearchEngine { // add type names from working copies if (copies != null) { - boolean isPkgCaseSensitive = (pkgMatchRule & SearchPattern.R_CASE_SENSITIVE) != 0; + boolean isPkgCaseSensitive = (pkgMatchRule & SearchPattern.R_CASE_SENSITIVE) != 0; for (int i = 0; i < copiesLength; i++) { SubMonitor iterationMonitor = subMonitor.split(1); final ICompilationUnit workingCopy = copies[i]; @@ -1368,7 +1368,7 @@ public class BasicSearchEngine { char[] packageDeclaration = packageDeclarations.length == 0 ? CharOperation.NO_CHAR : packageDeclarations[0].getElementName().toCharArray(); if (packageName != null && !CharOperation.equals(packageName, packageDeclaration, isPkgCaseSensitive)) continue; - + IType[] allTypes = workingCopy.getAllTypes(); for (int j = 0, allTypesLength = allTypes.length; j < allTypesLength; j++) { IType type = allTypes[j]; @@ -1379,7 +1379,7 @@ public class BasicSearchEngine { !match(declaringSimpleName, declSimpleNameMatchRule, rSimpleName)) continue; reportMatchingMethods(methodName, methodMatchRule, nameRequestor, path, - packageDeclaration, type, rDeclaringQualification, rSimpleName); + packageDeclaration, type, rDeclaringQualification, rSimpleName); } } else { Parser basicParser = getParser(); @@ -1395,7 +1395,7 @@ public class BasicSearchEngine { public IType type; public boolean visitMethods; public char[] enclosingTypeName; - + TypeInfo(TypeDeclaration typeDecl, boolean visitMethods, char[] enclosingTypeName) { this.typeDecl = typeDecl; this.type = workingCopy.getType(new String(typeDecl.name)); @@ -1443,13 +1443,13 @@ public class BasicSearchEngine { if (typeInfo.visitMethods && match(methodName, methodMatchRule, methodDeclaration.selector)) { reportMatchingMethod(path, packageDeclaration, - typeInfo.enclosingTypeName, - typeInfo.typeDecl, + typeInfo.enclosingTypeName, + typeInfo.typeDecl, methodDeclaration, getCurrentType(), nameRequestor); } - + return false; // no need to find methods from local/anonymous type } @Override @@ -1481,7 +1481,7 @@ public class BasicSearchEngine { final String path, final char[] packageDeclaration, final char[] declaringQualifier, - final TypeDeclaration typeDeclaration, + final TypeDeclaration typeDeclaration, final MethodDeclaration methodDeclaration, final IType type, final IRestrictedAccessMethodRequestor nameRequestor) { @@ -1506,19 +1506,19 @@ public class BasicSearchEngine { } else { char[] returnType = CharOperation.toString(methodDeclaration.returnType.getTypeName()).toCharArray(); nameRequestor.acceptMethod( - methodDeclaration.selector, - argsLength, - declaringQualifier, - typeDeclaration.name, - typeDeclaration.modifiers, - packageDeclaration, - null, - parameterTypes, - parameterNames, - returnType, - methodDeclaration.modifiers, - path, - null, + methodDeclaration.selector, + argsLength, + declaringQualifier, + typeDeclaration.name, + typeDeclaration.modifiers, + packageDeclaration, + null, + parameterTypes, + parameterNames, + returnType, + methodDeclaration.modifiers, + path, + null, -1 /* method index */); } } @@ -1527,11 +1527,11 @@ public class BasicSearchEngine { IType type, char[] rDeclaringQualification, char[] rSimpleName) throws JavaModelException { IMethod[] methods = type.getMethods(); - + for (int k = 0; k < methods.length; k++) { IMethod method = methods[k]; if (method.isConstructor()) continue; - + char[] rMethodName = method.getElementName().toCharArray(); if (match(methodName, methodMatchRule, rMethodName)) { if (nameRequestor instanceof MethodNameMatchRequestorWrapper) { @@ -1552,20 +1552,20 @@ public class BasicSearchEngine { char[] returnErasure = Signature.toCharArray(Signature.getTypeErasure(signature)); CharOperation.replace(returnErasure, '$', '.'); char[] returnTypeName = returnErasure; - + nameRequestor.acceptMethod( - rMethodName, - parameterNames.length, - rDeclaringQualification, - rSimpleName, + rMethodName, + parameterNames.length, + rDeclaringQualification, + rSimpleName, type.getFlags(), - packageDeclaration, - null, // signature not used for source - parameterTypes, - parameterNames, - returnTypeName, - method.getFlags(), - path, + packageDeclaration, + null, // signature not used for source + parameterTypes, + parameterNames, + returnTypeName, + method.getFlags(), + path, null, k); } @@ -1601,10 +1601,10 @@ public class BasicSearchEngine { buffer.append(waitForIndexes); Util.verbose(buffer.toString()); } - + IndexManager indexManager = JavaModelManager.getIndexManager(); final TypeDeclarationPattern pattern = new SecondaryTypeDeclarationPattern(); - + // Get working copy path(s). Store in a single string in case of only one to optimize comparison in requestor final HashSet workingCopyPaths = new HashSet(); String workingCopyPath = null; @@ -1621,7 +1621,7 @@ public class BasicSearchEngine { } } final String singleWkcpPath = workingCopyPath; - + // Index requestor IndexQueryRequestor searchRequestor = new IndexQueryRequestor(){ @Override @@ -1648,7 +1648,7 @@ public class BasicSearchEngine { } break; } - + // Accept document path AccessRestriction accessRestriction = null; if (access != null) { @@ -1676,7 +1676,7 @@ public class BasicSearchEngine { return true; } }; - + // add type names from indexes try { SubMonitor subMonitor = SubMonitor.convert(progressMonitor, Messages.engine_searching, 100); @@ -1722,7 +1722,7 @@ public class BasicSearchEngine { try { // Validate match rule first final int validatedTypeMatchRule = SearchPattern.validateMatchRule(typeName == null ? null : new String (typeName), typeMatchRule); - + // Debug if (VERBOSE) { Util.verbose("BasicSearchEngine.searchAllTypeNames(char[], char[], int, int, IJavaSearchScope, IRestrictedAccessTypeRequestor, int, IProgressMonitor)"); //$NON-NLS-1$ @@ -1737,7 +1737,7 @@ public class BasicSearchEngine { Util.verbose(" - scope: "+scope); //$NON-NLS-1$ } if (validatedTypeMatchRule == -1) return; // invalid match rule => return no results - + // Create pattern IndexManager indexManager = JavaModelManager.getIndexManager(); final char typeSuffix; @@ -1780,7 +1780,7 @@ public class BasicSearchEngine { typeName, typeSuffix, validatedTypeMatchRule); - + // Get working copy path(s). Store in a single string in case of only one to optimize comparison in requestor final HashSet workingCopyPaths = new HashSet(); String workingCopyPath = null; @@ -1797,7 +1797,7 @@ public class BasicSearchEngine { } } final String singleWkcpPath = workingCopyPath; - + // Index requestor IndexQueryRequestor searchRequestor = new IndexQueryRequestor(){ @Override @@ -1821,7 +1821,7 @@ public class BasicSearchEngine { } break; } - + // Accept document path AccessRestriction accessRestriction = null; if (access != null) { @@ -1851,7 +1851,7 @@ public class BasicSearchEngine { return true; } }; - + SubMonitor subMonitor = SubMonitor.convert(progressMonitor, Messages.engine_searching, 1000); // add type names from indexes indexManager.performConcurrentJob( @@ -1862,7 +1862,7 @@ public class BasicSearchEngine { searchRequestor), waitingPolicy, subMonitor.split(Math.max(1000-copiesLength, 0))); - + // add type names from working copies if (copies != null) { for (int i = 0; i < copiesLength; i++) { @@ -1999,7 +1999,7 @@ public class BasicSearchEngine { Util.verbose(" - scope: "+scope); //$NON-NLS-1$ } IndexManager indexManager = JavaModelManager.getIndexManager(); - + // Create pattern final char typeSuffix; switch(searchFor){ @@ -2029,7 +2029,7 @@ public class BasicSearchEngine { break; } final MultiTypeDeclarationPattern pattern = new MultiTypeDeclarationPattern(qualifications, typeNames, typeSuffix, matchRule); - + // Get working copy path(s). Store in a single string in case of only one to optimize comparison in requestor final HashSet workingCopyPaths = new HashSet(); String workingCopyPath = null; @@ -2046,7 +2046,7 @@ public class BasicSearchEngine { } } final String singleWkcpPath = workingCopyPath; - + // Index requestor IndexQueryRequestor searchRequestor = new IndexQueryRequestor(){ @Override @@ -2070,7 +2070,7 @@ public class BasicSearchEngine { } break; } - + // Accept document path AccessRestriction accessRestriction = null; if (access != null) { @@ -2082,7 +2082,7 @@ public class BasicSearchEngine { if (qualificationLength > 0) { System.arraycopy(record.qualification, 0, path, pos, qualificationLength - 1); CharOperation.replace(path, '.', '/'); - + // Access rules work on package level and should not discriminate on enclosing types. boolean isNestedType = record.enclosingTypeNames != null && record.enclosingTypeNames.length > 0; path[qualificationLength-1] = isNestedType ? '$' : '/'; @@ -2101,7 +2101,7 @@ public class BasicSearchEngine { return true; } }; - + SubMonitor subMonitor = SubMonitor.convert(progressMonitor, Messages.engine_searching, 100); // add type names from indexes indexManager.performConcurrentJob( @@ -2112,7 +2112,7 @@ public class BasicSearchEngine { searchRequestor), waitingPolicy, subMonitor.split(100)); - + // add type names from working copies if (copies != null) { for (int i = 0, length = copies.length; i < length; i++) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/HierarchyScope.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/HierarchyScope.java index 304653223..118374923 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/HierarchyScope.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/HierarchyScope.java @@ -68,13 +68,13 @@ public class HierarchyScope extends AbstractSearchScope implements SuffixConstan /** * Creates a new hierarchy scope for the given type with the given configuration options. - * @param project constrain the search result to this project, - * or <code>null</code> if search should consider all types in the workspace + * @param project constrain the search result to this project, + * or <code>null</code> if search should consider all types in the workspace * @param type the focus type of the hierarchy - * @param owner the owner of working copies that take precedence over original compilation units, + * @param owner the owner of working copies that take precedence over original compilation units, * or <code>null</code> if the primary working copy owner should be used * @param onlySubtypes if true search only subtypes of 'type' - * @param noMembersOrEnclosingTypes if true the hierarchy is strict, + * @param noMembersOrEnclosingTypes if true the hierarchy is strict, * i.e., no additional member types or enclosing types of types spanning the hierarchy are included, * otherwise all member and enclosing types of types in the hierarchy are included. * @param includeFocusType if true the focus type <code>type</code> is included in the resulting scope, otherwise it is excluded @@ -331,15 +331,15 @@ public class HierarchyScope extends AbstractSearchScope implements SuffixConstan } return false; } - /** + /** * Optionally perform additional checks after element has already passed matching based on index/documents. - * + * * @param element the given element - * @return <code>true</code> if the element is enclosed or if no fine grained checking + * @return <code>true</code> if the element is enclosed or if no fine grained checking * (regarding subtypes and members) is requested */ public boolean enclosesFineGrained(IJavaElement element) { - if ((this.subTypes == null) && this.allowMemberAndEnclosingTypes) + if ((this.subTypes == null) && this.allowMemberAndEnclosingTypes) return true; // no fine grained checking requested return encloses(element, null); } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IRestrictedAccessTypeRequestor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IRestrictedAccessTypeRequestor.java index bebfd1027..6ce7315dc 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IRestrictedAccessTypeRequestor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IRestrictedAccessTypeRequestor.java @@ -21,7 +21,7 @@ import org.eclipse.jdt.internal.compiler.env.AccessRestriction; * @see org.eclipse.jdt.core.search.TypeNameRequestor */ public interface IRestrictedAccessTypeRequestor { - + public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path, AccessRestriction access); } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexQueryRequestor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexQueryRequestor.java index 9a8d80d07..171ad7a45 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexQueryRequestor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexQueryRequestor.java @@ -21,8 +21,8 @@ import org.eclipse.jdt.internal.compiler.env.AccessRuleSet; * TODO add spec */ public abstract class IndexQueryRequestor { - + // answer false if requesting cancel public abstract boolean acceptIndexMatch(String documentPath, SearchPattern indexRecord, SearchParticipant participant, AccessRuleSet access); - + } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java index 092f4b6cb..fdf45f82a 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java @@ -42,12 +42,12 @@ import org.eclipse.jdt.internal.core.search.matching.ModulePattern; */ @SuppressWarnings({"rawtypes", "unchecked"}) public class IndexSelector { - + //TODO: Bug 386113: "Search references" and "Type hierarchy" show inconsistent results with "External Plug-in Libraries" project public static final int PROJECT_CAN_SEE_FOCUS= 0; public static final int PROJECT_SOURCE_CAN_NOT_SEE_FOCUS= 1; public static final int PROJECT_CAN_NOT_SEE_FOCUS= 2; - + IJavaSearchScope searchScope; SearchPattern pattern; IndexLocation[] indexLocations; // cache of the keys for looking index up @@ -216,7 +216,7 @@ private void initializeIndexLocations() { } else { try { // See whether the state builder might be used to reduce the number of index locations - + // find the projects from projectsAndJars that see the focus then walk those projects looking for the jars from projectsAndJars int length = projectsAndJars.length; JavaProject[] projectsCanSeeFocus = new JavaProject[length]; @@ -329,7 +329,7 @@ private char[][][] getQualifiedNames(ObjectVector types) { if (primaryType != null) { focusQualifiedNames = new char[size+1][][]; focusQualifiedNames[index++] = CharOperation.splitOn('.', primaryType.getFullyQualifiedName().toCharArray()); - } + } } if (focusQualifiedNames == null) { focusQualifiedNames = new char[size][][]; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchDocument.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchDocument.java index 491b1393b..d3a30d679 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchDocument.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchDocument.java @@ -26,11 +26,11 @@ import org.eclipse.jdt.internal.core.search.processing.JobManager; import org.eclipse.jdt.internal.core.util.Util; public class JavaSearchDocument extends SearchDocument { - + private IFile file; protected byte[] byteContents; protected char[] charContents; - + public JavaSearchDocument(String documentPath, SearchParticipant participant) { super(documentPath, participant); } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchMethodNameMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchMethodNameMatch.java index 895bce557..ac0c164b4 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchMethodNameMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchMethodNameMatch.java @@ -22,10 +22,10 @@ import org.eclipse.jdt.core.search.MethodNameMatch; * */ public class JavaSearchMethodNameMatch extends MethodNameMatch { - + IMethod method = null; int modifiers = -1; - + private int accessibility = IAccessRule.K_ACCESSIBLE; // TODO: this pertains to class/type - need to revisit whether this is required in method name match public JavaSearchMethodNameMatch(IMethod method, int modifiers) { this.method = method; @@ -46,11 +46,11 @@ public class JavaSearchMethodNameMatch extends MethodNameMatch { public IMethod getMethod() { return this.method; } - + public void setAccessibility(int accessibility) { this.accessibility = accessibility; } - + @Override public String toString() { return this.method == null ? super.toString() : this.method.toString(); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java index eec557caf..125859b21 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java @@ -49,13 +49,13 @@ import org.eclipse.jdt.internal.core.util.Util; */ @SuppressWarnings({"rawtypes", "unchecked"}) public class JavaSearchScope extends AbstractJavaSearchScope { - + private ArrayList elements; - /* The paths of the resources in this search scope - (or the classpath entries' paths if the resources are projects) + /* The paths of the resources in this search scope + (or the classpath entries' paths if the resources are projects) */ - private ArrayList projectPaths = new ArrayList(); // container paths projects + private ArrayList projectPaths = new ArrayList(); // container paths projects private int[] projectIndexes; // Indexes of projects in list private String[] containerPaths; // path to the container (e.g. /P/src, /P/lib.jar, c:\temp\mylib.jar) private String[] relativePaths; // path relative to the container (e.g. x/y/Z.class, x/y, (empty)) @@ -63,7 +63,7 @@ public class JavaSearchScope extends AbstractJavaSearchScope { protected AccessRuleSet[] pathRestrictions; private int pathsCount; private int threshold; - + private IPath[] enclosingProjectsAndJars; public final static AccessRuleSet NOT_ENCLOSED = new AccessRuleSet(null, (byte) 0, null); @@ -76,11 +76,11 @@ public JavaSearchScope(boolean excludeTestCode) { private JavaSearchScope(int size, boolean excludeTestCode) { this.excludeTestCode = excludeTestCode; initialize(size); - + //disabled for now as this could be expensive //JavaModelManager.getJavaModelManager().rememberScope(this); } - + private void addEnclosingProjectOrJar(IPath path) { int length = this.enclosingProjectsAndJars.length; for (int i = 0; i < length; i++) { @@ -112,7 +112,7 @@ public void add(JavaProject project, int includeMask, HashSet projectsToBeAdded) * @param projectsToBeAdded Set to avoid infinite recursion * @param visitedProjects Set to avoid adding twice the same project * @param referringEntry Project raw entry in referring project classpath - * @throws JavaModelException May happen while getting java model info + * @throws JavaModelException May happen while getting java model info */ void add(JavaProject javaProject, IPath pathToAdd, int includeMask, HashSet projectsToBeAdded, HashSet visitedProjects, IClasspathEntry referringEntry) throws JavaModelException { IProject project = javaProject.getProject(); @@ -226,7 +226,7 @@ public void add(IJavaElement element) throws JavaModelException { switch (element.getElementType()) { case IJavaElement.JAVA_MODEL: // a workspace sope should be used - break; + break; case IJavaElement.JAVA_PROJECT: add((JavaProject)element, null, includeMask, new HashSet(2), new HashSet(2), null); break; @@ -288,7 +288,7 @@ public void add(IJavaElement element) throws JavaModelException { containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); add(projectPath, relativePath, containerPathToString, false/*not a package*/, null); } - + if (root != null) addEnclosingProjectOrJar(root.getKind() == IPackageFragmentRoot.K_SOURCE ? root.getParent().getPath() : root.getPath()); } @@ -333,15 +333,15 @@ private void add(String projectPath, String relativePath, String containerPath, rehash(); } -/* +/* * E.g. - * + * * 1. /P/src/pkg/X.java * 2. /P/src/pkg * 3. /P/lib.jar|org/eclipse/jdt/core/IJavaElement.class * 4. /home/mylib.jar|x/y/z/X.class * 5. c:\temp\mylib.jar|x/y/Y.class - * + * * @see IJavaSearchScope#encloses(String) */ @Override @@ -360,7 +360,7 @@ public boolean encloses(String resourcePathString) { /** * Returns paths list index of given path or -1 if not found. * NOTE: Use indexOf(String, String) for path inside jars - * + * * @param fullPath the full path of the resource, e.g. * 1. /P/src/pkg/X.java * 2. /P/src/pkg @@ -417,7 +417,7 @@ private int indexOf(String containerPath, String relativePath) { private boolean encloses(String enclosingPath, String path, int index) { // normalize given path as it can come from outside path = normalize(path); - + int pathLength = path.length(); int enclosingLength = enclosingPath.length(); if (pathLength < enclosingLength) { @@ -433,10 +433,10 @@ private boolean encloses(String enclosingPath, String path, int index) { return path.startsWith(enclosingPath) && path.charAt(enclosingLength) == '/'; } else { - // if looking at a package, this scope encloses the given path + // if looking at a package, this scope encloses the given path // if the given path is a direct child of the folder // or if the given path path is the folder path (see bug 13919 Declaration for package not found if scope is not project) - if (path.startsWith(enclosingPath) + if (path.startsWith(enclosingPath) && ((enclosingPath.length() == path.lastIndexOf('/')) || (enclosingPath.length() == path.length()))) { return true; @@ -553,7 +553,7 @@ public void processDelta(IJavaElementDelta delta, int eventType) { if (this.encloses(element)) { if (this.elements != null) { this.elements.remove(element); - } + } String path = null; switch (element.getElementType()) { case IJavaElement.JAVA_PROJECT: diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchTypeNameMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchTypeNameMatch.java index 2f00a705d..fd001f9c3 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchTypeNameMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchTypeNameMatch.java @@ -18,7 +18,7 @@ import org.eclipse.jdt.core.search.*; /** * Java Search concrete class for a type name match. - * + * * @since 3.3 */ public class JavaSearchTypeNameMatch extends TypeNameMatch { @@ -85,7 +85,7 @@ public int hashCode() { /** * Sets the accessibility of the accepted match. - * + * * @param accessibility the accessibility of the current match */ public void setAccessibility(int accessibility) { @@ -94,7 +94,7 @@ public void setAccessibility(int accessibility) { /** * Set modifiers of the matched type. - * + * * @param modifiers the modifiers of the matched type. */ public void setModifiers(int modifiers) { @@ -103,7 +103,7 @@ public void setModifiers(int modifiers) { /** * Set matched type. - * + * * @param type the matched type. */ public void setType(IType type) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/MethodNameMatchRequestorWrapper.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/MethodNameMatchRequestorWrapper.java index 75cb2d086..b393cc5f5 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/MethodNameMatchRequestorWrapper.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/MethodNameMatchRequestorWrapper.java @@ -36,7 +36,7 @@ import org.eclipse.jdt.internal.compiler.env.AccessRestriction; * IJavaSearchScope scope, * IRestrictedAccessMethodRequestor methodRequestor, * int waitingPolicy, - * IProgressMonitor progressMonitor)} from API method + * IProgressMonitor progressMonitor)} from API method * {@link org.eclipse.jdt.core.search.SearchEngine#searchAllMethodNames( * char[] packageName, * int pkgMatchRule, diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/MethodNameRequestorWrapper.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/MethodNameRequestorWrapper.java index d8b4a788b..51dfb4a18 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/MethodNameRequestorWrapper.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/MethodNameRequestorWrapper.java @@ -45,13 +45,13 @@ import org.eclipse.jdt.internal.compiler.env.AccessRestriction; * IJavaSearchScope scope, * MethodNameRequestor methodRequestor, * int waitingPolicy, - * IProgressMonitor progressMonitor)}. + * IProgressMonitor progressMonitor)}. * */ public class MethodNameRequestorWrapper implements IRestrictedAccessMethodRequestor { - + MethodNameRequestor requestor; - + public MethodNameRequestorWrapper(MethodNameRequestor requestor) { this.requestor = requestor; } @@ -61,7 +61,7 @@ public class MethodNameRequestorWrapper implements IRestrictedAccessMethodReques char[] simpleTypeName, int typeModifiers, char[] packageName, char[] signature, char[][] parameterTypes, char[][] parameterNames, char[] returnType, int modifiers, String path, AccessRestriction access, int methodIndex) { - this.requestor.acceptMethod(methodName, parameterCount, declaringQualification, simpleTypeName, typeModifiers, + this.requestor.acceptMethod(methodName, parameterCount, declaringQualification, simpleTypeName, typeModifiers, packageName, signature, parameterTypes, parameterNames, returnType, modifiers, path, methodIndex); } } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/NameMatchRequestorWrapper.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/NameMatchRequestorWrapper.java index 923e42556..2480f99a8 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/NameMatchRequestorWrapper.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/NameMatchRequestorWrapper.java @@ -125,7 +125,7 @@ private IType createTypeFromJar(String resourcePath, int separatorIndex) throws IPackageFragment pkgFragment= (IPackageFragment) this.packageHandles.get(pkgName); if (pkgFragment == null) { pkgFragment= ((PackageFragmentRoot) this.lastPkgFragmentRoot).getPackageFragment(pkgName, moduleName); //BUG 478143 - // filter org.apache.commons.lang.enum package for projects above 1.5 + // filter org.apache.commons.lang.enum package for projects above 1.5 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=317264 if (length == 5 && pkgName[4].equals("enum")) { //$NON-NLS-1$ IJavaProject proj = (IJavaProject)pkgFragment.getAncestor(IJavaElement.JAVA_PROJECT); @@ -136,7 +136,7 @@ private IType createTypeFromJar(String resourcePath, int separatorIndex) throws } if (this.complianceValue >= ClassFileConstants.JDK1_5) return null; - } + } this.packageHandles.put(pkgName, pkgFragment); } return pkgFragment.getOrdinaryClassFile(simpleNames[length]).getType(); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PathCollector.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PathCollector.java index 0ffc5fb35..a381f58a9 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PathCollector.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PathCollector.java @@ -24,7 +24,7 @@ import org.eclipse.jdt.internal.compiler.env.AccessRuleSet; */ @SuppressWarnings({"rawtypes", "unchecked"}) public class PathCollector extends IndexQueryRequestor { - + /* a set of resource paths */ public HashSet paths = new HashSet(5); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java index ab1f94f83..6af6d897b 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java @@ -51,7 +51,7 @@ public boolean belongsTo(String jobFamily) { } @Override public void cancel() { - // search job is cancelled through progress + // search job is cancelled through progress } @Override public void ensureReadyToRun() { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/SubTypeSearchJob.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/SubTypeSearchJob.java index 00679f38b..42b5656d5 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/SubTypeSearchJob.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/SubTypeSearchJob.java @@ -40,7 +40,7 @@ public Index[] getIndexes(IProgressMonitor progressMonitor) { Index[] values = new Index[this.indexes.elementSize]; this.indexes.asArray(values); return values; -} +} @Override public boolean search(Index index, IProgressMonitor progressMonitor) { if (index == null) return COMPLETE; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/TypeNameRequestorWrapper.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/TypeNameRequestorWrapper.java index 55dfb89fd..214710794 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/TypeNameRequestorWrapper.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/TypeNameRequestorWrapper.java @@ -19,22 +19,22 @@ import org.eclipse.jdt.internal.compiler.env.AccessRestriction; /** * Wrapper used to link {@link IRestrictedAccessTypeRequestor} with {@link TypeNameRequestor}. * This wrapper specifically allows usage of internal method {@link BasicSearchEngine#searchAllTypeNames( - * char[] packageName, - * int packageMatchRule, + * char[] packageName, + * int packageMatchRule, * char[] typeName, - * int typeMatchRule, - * int searchFor, - * org.eclipse.jdt.core.search.IJavaSearchScope scope, + * int typeMatchRule, + * int searchFor, + * org.eclipse.jdt.core.search.IJavaSearchScope scope, * IRestrictedAccessTypeRequestor nameRequestor, * int waitingPolicy, * org.eclipse.core.runtime.IProgressMonitor monitor) }. * from API method {@link org.eclipse.jdt.core.search.SearchEngine#searchAllTypeNames( - * char[] packageName, - * int packageMatchRule, + * char[] packageName, + * int packageMatchRule, * char[] typeName, - * int matchRule, - * int searchFor, - * org.eclipse.jdt.core.search.IJavaSearchScope scope, + * int matchRule, + * int searchFor, + * org.eclipse.jdt.core.search.IJavaSearchScope scope, * TypeNameRequestor nameRequestor, * int waitingPolicy, * org.eclipse.core.runtime.IProgressMonitor monitor) }. diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/UnindexedSearchScope.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/UnindexedSearchScope.java index 1b6135bac..5fdc740c0 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/UnindexedSearchScope.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/UnindexedSearchScope.java @@ -26,7 +26,7 @@ import org.eclipse.jdt.core.search.IJavaSearchScope; public class UnindexedSearchScope extends AbstractSearchScope { private IJavaSearchScope searchScope; - + private UnindexedSearchScope(IJavaSearchScope scope) { this.searchScope = scope; } @@ -34,7 +34,7 @@ public class UnindexedSearchScope extends AbstractSearchScope { public static IJavaSearchScope filterEntriesCoveredByTheNewIndex(IJavaSearchScope scope) { return new UnindexedSearchScope(scope); } - + @Override public boolean encloses(String resourcePathString) { int separatorIndex = resourcePathString.indexOf(JAR_FILE_ENTRY_SEPARATOR); @@ -76,9 +76,9 @@ public class UnindexedSearchScope extends AbstractSearchScope { @Override public IPath[] enclosingProjectsAndJars() { IPath[] unfiltered = this.searchScope.enclosingProjectsAndJars(); - + List<IPath> result = new ArrayList<>(); - + for (IPath next : unfiltered) { if (isJarFile(next.lastSegment())) { continue; @@ -92,7 +92,7 @@ public class UnindexedSearchScope extends AbstractSearchScope { public void processDelta(IJavaElementDelta delta, int eventType) { if (this.searchScope instanceof AbstractSearchScope) { AbstractSearchScope inner = (AbstractSearchScope) this.searchScope; - + inner.processDelta(delta, eventType); } } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java index ec01ab497..ce1c3b51f 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java @@ -35,7 +35,7 @@ public abstract class AbstractIndexer implements IIndexConstants { addTypeDeclaration(modifiers, packageName, name, enclosingTypeNames, secondary); addIndexEntry( - SUPER_REF, + SUPER_REF, SuperTypeReferencePattern.createIndexKey( modifiers, packageName, name, enclosingTypeNames, null, ANNOTATION_TYPE_SUFFIX, CharOperation.concatWith(TypeConstants.JAVA_LANG_ANNOTATION_ANNOTATION, '.'), ANNOTATION_TYPE_SUFFIX)); } @@ -43,11 +43,11 @@ public abstract class AbstractIndexer implements IIndexConstants { addIndexEntry(ANNOTATION_REF, CharOperation.lastSegment(typeName, '.')); } public void addClassDeclaration( - int modifiers, + int modifiers, char[] packageName, - char[] name, - char[][] enclosingTypeNames, - char[] superclass, + char[] name, + char[][] enclosingTypeNames, + char[] superclass, char[][] superinterfaces, //{ObjectTeams: baseclass char[] baseclass, @@ -69,13 +69,13 @@ public abstract class AbstractIndexer implements IIndexConstants { { //addIndexEntry(TYPE_DECL, TypeDeclarationPattern.createIndexKey(name, packageName, enclosingTypeNames, ROLE_SUFFIX)); addIndexEntry(ROLE_DECL, otCreateTypeIndexKey(modifiers, name, packageName, enclosingTypeNames, secondary)); - + } if (baseclass != null) { // baseclass cannot be generic, but FIXME(SH): requires anchor translation! addTypeReference(baseclass); addIndexEntry( - SUPER_REF, + SUPER_REF, SuperTypeReferencePattern.createIndexKey( modifiers, packageName, name, enclosingTypeNames, typeParameterSignatures, CLASS_SUFFIX, baseclass, BASECLASS_SUFFIX)); } @@ -86,7 +86,7 @@ public abstract class AbstractIndexer implements IIndexConstants { addTypeReference(superclass); } addIndexEntry( - SUPER_REF, + SUPER_REF, SuperTypeReferencePattern.createIndexKey( modifiers, packageName, name, enclosingTypeNames, typeParameterSignatures, CLASS_SUFFIX, superclass, CLASS_SUFFIX)); //{ObjectTeams: handle team inheriting from possibly non-team: @@ -94,7 +94,7 @@ public abstract class AbstractIndexer implements IIndexConstants { addIndexEntry( SUPER_REF, SuperTypeReferencePattern.createIndexKey( - modifiers, packageName, name, enclosingTypeNames, typeParameterSignatures, CLASS_SUFFIX, ITEAM, INTERFACE_SUFFIX)); + modifiers, packageName, name, enclosingTypeNames, typeParameterSignatures, CLASS_SUFFIX, ITEAM, INTERFACE_SUFFIX)); // SH} if (superinterfaces != null) { for (int i = 0, max = superinterfaces.length; i < max; i++) { @@ -109,7 +109,7 @@ public abstract class AbstractIndexer implements IIndexConstants { } private char[] erasure(char[] typeName) { int genericStart = CharOperation.indexOf(Signature.C_GENERIC_START, typeName); - if (genericStart > -1) + if (genericStart > -1) typeName = CharOperation.subarray(typeName, 0, genericStart); return typeName; } @@ -136,7 +136,7 @@ public abstract class AbstractIndexer implements IIndexConstants { packageName, typeModifiers, extraFlags)); - + if (parameterTypes != null) { for (int i = 0; i < argCount; i++) addTypeReference(parameterTypes[i]); @@ -164,7 +164,7 @@ public abstract class AbstractIndexer implements IIndexConstants { addTypeDeclaration(modifiers, packageName, name, enclosingTypeNames, secondary); addIndexEntry( - SUPER_REF, + SUPER_REF, SuperTypeReferencePattern.createIndexKey( modifiers, packageName, name, enclosingTypeNames, null, ENUM_SUFFIX, superclass, CLASS_SUFFIX)); if (superinterfaces != null) { @@ -177,7 +177,7 @@ public abstract class AbstractIndexer implements IIndexConstants { modifiers, packageName, name, enclosingTypeNames, null, ENUM_SUFFIX, superinterface, INTERFACE_SUFFIX)); } } - } + } public void addFieldDeclaration(char[] typeName, char[] fieldName) { addIndexEntry(FIELD_DECL, FieldPattern.createIndexKey(fieldName)); addTypeReference(typeName); @@ -240,7 +240,7 @@ public abstract class AbstractIndexer implements IIndexConstants { public void addMethodDeclaration(char[] methodName, char[][] parameterTypes, char[] returnType, char[][] exceptionTypes) { int argCount = parameterTypes == null ? 0 : parameterTypes.length; addIndexEntry(METHOD_DECL, MethodPattern.createIndexKey(methodName, argCount)); - + if (parameterTypes != null) { for (int i = 0; i < argCount; i++) addTypeReference(parameterTypes[i]); @@ -281,13 +281,13 @@ public abstract class AbstractIndexer implements IIndexConstants { public void addTypeReference(char[] typeName) { addNameReference(CharOperation.lastSegment(typeName, '.')); } - + //{OTDTUI: public void addBaseReference(char[] baseName) { addIndexEntry(BASE_REF, baseName); } - + public void addReferenceToTeamPackage(char[] teamName, char[] roleName) { // add two index entries (one with role name, one without). See ReferenceToTeamPackagePattern.getIndexKey() @@ -303,14 +303,14 @@ public abstract class AbstractIndexer implements IIndexConstants { * i.e. instead of "type/enclosingTypes/package/C" create a key * "type/enclosingTypes/package/C/123549" * 123549 would be the type's modifiers, including AccTeam and AccRole. - */ + */ private static char[] otCreateTypeIndexKey(int modifiers, char[] name, char[] packageName, char[][] enclosingTypeNames, boolean secondary) // int modifiers, char[] typeName, char[] packageName, char[][] enclosingTypeNames, boolean secondary) { //, char typeSuffix) { { // km: merge: modified signature // orig: char[] indexKey = TypeDeclarationPattern.createIndexKey(name, packageName, enclosingTypeNames, class_suffix); char[] indexKey = TypeDeclarationPattern.createIndexKey(modifiers, name, packageName, enclosingTypeNames, secondary); - + String modifierString = String.valueOf(modifiers); char [] otIndexKey = new char[indexKey.length + 1 + modifierString.length()]; System.arraycopy(indexKey, 0, otIndexKey, 0, indexKey.length); @@ -320,7 +320,7 @@ public abstract class AbstractIndexer implements IIndexConstants { return otIndexKey; } //carp} - + public abstract void indexDocument(); public void indexResolvedDocument() { // subtypes should implement where it makes sense. diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java index aa6f0e53d..ea722725c 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java @@ -92,7 +92,7 @@ class AddJarFileToIndex extends BinaryContainer { if (hasPreBuiltIndex()) { boolean added = this.manager.addIndex(this.containerPath, this.indexFileURL); - if (added) return true; + if (added) return true; this.indexFileURL = null; } @@ -235,7 +235,7 @@ class AddJarFileToIndex extends BinaryContainer { // iterate each entry to index it ZipEntry ze = (ZipEntry) e.nextElement(); String zipEntryName = ze.getName(); - if (Util.isClassFileName(zipEntryName) && + if (Util.isClassFileName(zipEntryName) && isValidPackageNameForClassOrisModule(zipEntryName)) { hasModuleInfoClass |= zipEntryName.contains(TypeConstants.MODULE_INFO_NAME_STRING); // index only classes coming from valid packages - https://bugs.eclipse.org/bugs/show_bug.cgi?id=293861 @@ -293,7 +293,7 @@ class AddJarFileToIndex extends BinaryContainer { if (this.resource != null) return super.getJobFamily(); return this.containerPath.toOSString(); // external jar - } + } @Override protected Integer updatedIndexState() { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJrtToIndex.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJrtToIndex.java index baa8c67cc..6401cbc20 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJrtToIndex.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJrtToIndex.java @@ -43,7 +43,7 @@ public class AddJrtToIndex extends BinaryContainer { private IndexLocation indexFileURL; private final boolean forceIndexUpdate; static final char JAR_SEPARATOR = IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR.charAt(0); - + enum FILE_INDEX_STATE { EXISTS, DELETED @@ -79,9 +79,9 @@ public class AddJrtToIndex extends BinaryContainer { return this.containerPath.hashCode(); return -1; } - + private class JrtTraverser implements org.eclipse.jdt.internal.compiler.util.JRTUtil.JrtFileVisitor<java.nio.file.Path> { - + SimpleLookupTable indexedFileNames; public JrtTraverser() { } @@ -99,7 +99,7 @@ public class AddJrtToIndex extends BinaryContainer { public FileVisitResult visitFile(java.nio.file.Path path, java.nio.file.Path mod, BasicFileAttributes attrs) throws IOException { String name = JRTUtil.sanitizedFileName(path); - if (Util.isClassFileName(name) && + if (Util.isClassFileName(name) && isValidPackageNameForClassOrisModule(name)) { this.indexedFileNames.put(name, FILE_INDEX_STATE.EXISTS); } @@ -110,7 +110,7 @@ public class AddJrtToIndex extends BinaryContainer { return FileVisitResult.CONTINUE; } } - + private class JrtIndexer extends JrtTraverser { final SearchParticipant participant; final IPath indexPath; @@ -133,7 +133,7 @@ public class AddJrtToIndex extends BinaryContainer { public FileVisitResult visitFile(java.nio.file.Path path, java.nio.file.Path mod, BasicFileAttributes attrs) throws IOException { String name = JRTUtil.sanitizedFileName(path); - if (Util.isClassFileName(name) && + if (Util.isClassFileName(name) && isValidPackageNameForClassOrisModule(name)) { try { String fullPath = path.toString(); @@ -157,7 +157,7 @@ public class AddJrtToIndex extends BinaryContainer { if (hasPreBuiltIndex()) { boolean added = this.manager.addIndex(this.containerPath, this.indexFileURL); - if (added) return true; + if (added) return true; this.indexFileURL = null; } @@ -211,7 +211,7 @@ public class AddJrtToIndex extends BinaryContainer { container = this.resource.getFullPath().makeRelative(); // absolute path relative to the workspace } else { - + fileName = this.containerPath.toOSString(); container = this.containerPath; } @@ -228,12 +228,12 @@ public class AddJrtToIndex extends BinaryContainer { * If not, then we want to check that there is no missing entry, if * one entry is missing then we recreate the index */ - + final SimpleLookupTable indexedFileNames = new SimpleLookupTable(max == 0 ? 33 : max + 11); for (int i = 0; i < max; i++) indexedFileNames.put(paths[i], FILE_INDEX_STATE.DELETED); - - org.eclipse.jdt.internal.compiler.util.JRTUtil.walkModuleImage(new File(fileName), + + org.eclipse.jdt.internal.compiler.util.JRTUtil.walkModuleImage(new File(fileName), new JrtTraverser(indexedFileNames), JRTUtil.NOTIFY_FILES); boolean needToReindex = indexedFileNames.elementSize != max; // a new file was added @@ -263,9 +263,9 @@ public class AddJrtToIndex extends BinaryContainer { this.manager.removeIndex(this.containerPath); return false; } - + File jrt = new File(fileName); - org.eclipse.jdt.internal.compiler.util.JRTUtil.walkModuleImage(jrt, + org.eclipse.jdt.internal.compiler.util.JRTUtil.walkModuleImage(jrt, new JrtIndexer(jrt, SearchEngine.getDefaultSearchParticipant(), index, container, this.manager), JRTUtil.NOTIFY_FILES); if(this.forceIndexUpdate) { @@ -296,7 +296,7 @@ public class AddJrtToIndex extends BinaryContainer { if (this.resource != null) return super.getJobFamily(); return this.containerPath.toOSString(); // external jar - } + } @Override protected Integer updatedIndexState() { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryContainer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryContainer.java index 44ccb0b0b..882f87980 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryContainer.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryContainer.java @@ -29,7 +29,7 @@ public abstract class BinaryContainer extends IndexRequest { private boolean isIdentifier() throws InvalidInputException { switch(this.scanner.scanIdentifier()) { - // assert and enum will not be recognized as java identifiers + // assert and enum will not be recognized as java identifiers // in 1.7 mode, which are in 1.3. case TerminalTokens.TokenNameIdentifier: case TerminalTokens.TokenNameassert: @@ -40,7 +40,7 @@ public abstract class BinaryContainer extends IndexRequest { } } protected boolean isValidPackageNameForClassOrisModule(String className) { - if (className.substring(0, className.length() - (SuffixConstants.SUFFIX_CLASS.length)).equals(new String(IIndexConstants.MODULE_INFO))) + if (className.substring(0, className.length() - (SuffixConstants.SUFFIX_CLASS.length)).equals(new String(IIndexConstants.MODULE_INFO))) return true; char[] classNameArray = className.toCharArray(); // use 1.7 as the source level as there are more valid identifiers in 1.7 mode @@ -48,8 +48,8 @@ public abstract class BinaryContainer extends IndexRequest { if (this.scanner == null) this.scanner = new Scanner(false /* comment */, true /* whitespace */, false /* nls */, ClassFileConstants.JDK1_7/* sourceLevel */, null/* taskTag */, null/* taskPriorities */, true /* taskCaseSensitive */); - - this.scanner.setSource(classNameArray); + + this.scanner.setSource(classNameArray); this.scanner.eofPosition = classNameArray.length - SuffixConstants.SUFFIX_CLASS.length; try { if (isIdentifier()) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java index 2ef37cd6d..dc7bc9c0f 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java @@ -274,32 +274,32 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { if (arrayDim > 0) return convertToArrayType(BYTE, arrayDim); return BYTE; - + case 'C': if (arrayDim > 0) return convertToArrayType(CHAR, arrayDim); return CHAR; - + case 'D': if (arrayDim > 0) return convertToArrayType(DOUBLE, arrayDim); return DOUBLE; - + case 'F': if (arrayDim > 0) return convertToArrayType(FLOAT, arrayDim); return FLOAT; - + case 'I': if (arrayDim > 0) return convertToArrayType(INT, arrayDim); return INT; - + case 'J': if (arrayDim > 0) return convertToArrayType(LONG, arrayDim); return LONG; - + case 'L': int indexOfSemiColon = CharOperation.indexOf(';', signature, i+1); if (indexOfSemiColon == -1) throw new ClassFormatException(ClassFormatException.ErrInvalidMethodSignature); @@ -307,24 +307,24 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { return convertToArrayType(replace('/','.',CharOperation.subarray(signature, i + 1, indexOfSemiColon)), arrayDim); } return replace('/','.',CharOperation.subarray(signature, i + 1, indexOfSemiColon)); - + case 'S': if (arrayDim > 0) return convertToArrayType(SHORT, arrayDim); return SHORT; - + case 'Z': if (arrayDim > 0) return convertToArrayType(BOOLEAN, arrayDim); return BOOLEAN; - + case 'V': return VOID; - + case '[': arrayDim++; break; - + default: throw new ClassFormatException(ClassFormatException.ErrInvalidMethodSignature); } @@ -361,7 +361,7 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { convertToArrayType(parameterTypes, parameterTypesCounter-1, arrayDim); arrayDim = 0; break; - + case 'C': parameterTypes[parameterTypesCounter++] = CHAR; if (arrayDim > 0) @@ -382,14 +382,14 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { convertToArrayType(parameterTypes, parameterTypesCounter-1, arrayDim); arrayDim = 0; break; - + case 'I': parameterTypes[parameterTypesCounter++] = INT; if (arrayDim > 0) convertToArrayType(parameterTypes, parameterTypesCounter-1, arrayDim); arrayDim = 0; break; - + case 'J': parameterTypes[parameterTypesCounter++] = LONG; if (arrayDim > 0) @@ -429,7 +429,7 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { case '[': arrayDim++; break; - + default: throw new ClassFormatException(ClassFormatException.ErrInvalidMethodSignature); } @@ -450,12 +450,12 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { if (arrayDim > 0) return convertToArrayType(BYTE, arrayDim); return BYTE; - + case 'C': if (arrayDim > 0) return convertToArrayType(CHAR, arrayDim); return CHAR; - + case 'D': if (arrayDim > 0) return convertToArrayType(DOUBLE, arrayDim); @@ -500,7 +500,7 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { case '[': arrayDim++; break; - + default: throw new ClassFormatException(ClassFormatException.ErrInvalidMethodSignature); } @@ -634,7 +634,7 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { break; // skip over array references name = replace('/', '.', name); // so that it looks like java.lang.String addTypeReference(name); - + // also add a simple reference on each segment of the qualification (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=24741) char[][] qualification = CharOperation.splitOn('.', name); for (int j = 0, length = qualification.length; j < length; j++) { @@ -658,13 +658,13 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { if (contents == null) return; final String path = this.document.getPath(); ClassFileReader reader = new ClassFileReader(contents, path == null ? null : path.toCharArray()); - + IModule module = reader.getModuleDeclaration(); if (module != null) { indexModule(module); return; } - + // first add type references char[] className = replace('/', '.', reader.getName()); // looks like java/lang/String // need to extract the package name and the simple name @@ -696,7 +696,7 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { // See PR 1GIR345: ITPJCORE:ALL - Indexer: NegativeArraySizeException return; } - enclosingTypeName = new char[nameLength]; + enclosingTypeName = new char[nameLength]; System.arraycopy(fullEnclosingName, packageNameIndex + 1, enclosingTypeName, 0, nameLength); } } @@ -707,10 +707,10 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { CharOperation.replace(genericSignature, '/', '.'); typeParameterSignatures = Signature.getTypeParameters(genericSignature); } - + // eliminate invalid innerclasses (1G4KCF7) if (name == null) return; - + char[][] superinterfaces = replace('/', '.', reader.getInterfaceNames()); char[][] enclosingTypeNames = enclosingTypeName == null ? null : new char[][] {enclosingTypeName}; int modifiers = reader.getModifiers(); @@ -746,7 +746,7 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { addClassDeclaration(modifiers, packageName, name, enclosingTypeNames, superclass, superinterfaces, null, typeParameterSignatures, false); // SH} break; - } + } // Look for references in class annotations IBinaryAnnotation[] annotations = reader.getAnnotations(); @@ -787,7 +787,7 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { addConstructorDeclaration( name, parameterTypes == null ? 0 : parameterTypes.length, - signature, + signature, parameterTypes, method.getArgumentNames(), method.getModifiers(), @@ -809,7 +809,7 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { null, selector, parameterTypes == null ? 0 : parameterTypes.length, - signature, + signature, parameterTypes, method.getArgumentNames(), returnType, @@ -872,7 +872,7 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { e)); } } - + private void indexModule(IModule module) { addModuleDeclaration(module.name()); IModuleReference[] requiredModules = module.requires(); @@ -922,7 +922,7 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { return; addTypeReference(ref); } - + private char[] removeFirstSyntheticParameter(char[] descriptor) { if (descriptor == null) return null; if (descriptor.length < 3) return descriptor; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/DefaultJavaIndexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/DefaultJavaIndexer.java index 8fdf25416..f298e3083 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/DefaultJavaIndexer.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/DefaultJavaIndexer.java @@ -33,7 +33,7 @@ import org.eclipse.jdt.internal.core.search.JavaSearchDocument; @SuppressWarnings("rawtypes") public class DefaultJavaIndexer { private static final char JAR_SEPARATOR = IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR.charAt(0); - + public void generateIndexForJar(String pathToJar, String pathToIndexFile) throws IOException { File f = new File(pathToJar); if (!f.exists()) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java index cb8a8b08d..f5a9e30b5 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java @@ -46,7 +46,7 @@ public interface IIndexConstants { char[] ITEAM = "org.objectteams.ITeam".toCharArray(); //$NON-NLS-1$ //Andreas Kaiser} - char[][] COUNTS= + char[][] COUNTS= new char[][] { new char[] {'/', '0'}, new char[] {'/', '1'}, new char[] {'/', '2'}, new char[] {'/', '3'}, new char[] {'/', '4'}, new char[] {'/', '5'}, new char[] {'/', '6'}, new char[] {'/', '7'}, new char[] {'/', '8'}, new char[] {'/', '9'} }; @@ -75,8 +75,8 @@ public interface IIndexConstants { char[][] ONE_STAR_CHAR = new char[][] {ONE_STAR}; // used as special marker for enclosing type name of local and anonymous classes - char ZERO_CHAR = '0'; - char[] ONE_ZERO = new char[] { ZERO_CHAR }; + char ZERO_CHAR = '0'; + char[] ONE_ZERO = new char[] { ZERO_CHAR }; char[][] ONE_ZERO_CHAR = new char[][] {ONE_ZERO}; int PKG_REF_PATTERN = 0x0001; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexAllProject.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexAllProject.java index ffa90a9c7..a9417fdcb 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexAllProject.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexAllProject.java @@ -61,7 +61,7 @@ public class IndexAllProject extends IndexRequest { if (this.isCancelled || progressMonitor != null && progressMonitor.isCanceled()) return true; if (!this.project.isAccessible()) return true; // nothing to do - + ReadWriteMonitor monitor = null; try { // Get source folder entries. Libraries are done as a separate job @@ -96,12 +96,12 @@ public class IndexAllProject extends IndexRequest { } if (sourceEntriesNumber != length) System.arraycopy(sourceEntries, 0, sourceEntries = new IClasspathEntry[sourceEntriesNumber], 0, sourceEntriesNumber); - + Index index = this.manager.getIndexForUpdate(this.containerPath, true, /*reuse index file*/ true /*create if none*/); if (index == null) return true; monitor = index.monitor; if (monitor == null) return true; // index got deleted since acquired - + monitor.enterRead(); // ask permission to read String[] paths = index.queryDocumentNames(""); // all file names //$NON-NLS-1$ @@ -122,7 +122,7 @@ public class IndexAllProject extends IndexRequest { IClasspathEntry entry = sourceEntries[i]; IResource sourceFolder = root.findMember(entry.getPath()); if (sourceFolder != null) { - + // collect output locations if source is project (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=32041) final HashSet outputs = new HashSet(); if (sourceFolder.getType() == IResource.PROJECT) { @@ -136,7 +136,7 @@ public class IndexAllProject extends IndexRequest { } } final boolean hasOutputs = !outputs.isEmpty(); - + final char[][] inclusionPatterns = ((ClasspathEntry) entry).fullInclusionPatternChars(); final char[][] exclusionPatterns = ((ClasspathEntry) entry).fullExclusionPatternChars(); if (max == 0) { @@ -158,7 +158,7 @@ public class IndexAllProject extends IndexRequest { case IResource.FOLDER : if (exclusionPatterns != null && inclusionPatterns == null) { // if there are inclusion patterns then we must walk the children - if (Util.isExcluded(proxy.requestFullPath(), inclusionPatterns, exclusionPatterns, true)) + if (Util.isExcluded(proxy.requestFullPath(), inclusionPatterns, exclusionPatterns, true)) return false; } if (hasOutputs && outputs.contains(proxy.requestFullPath())) @@ -186,7 +186,7 @@ public class IndexAllProject extends IndexRequest { return false; String relativePathString = Util.relativePath(file.getFullPath(), 1/*remove project segment*/); indexedFileNames.put(relativePathString, - indexedFileNames.get(relativePathString) == null + indexedFileNames.get(relativePathString) == null || indexLastModified < EFS.getStore(location).fetchInfo().getLastModified() ? (Object) file : (Object) OK); @@ -207,7 +207,7 @@ public class IndexAllProject extends IndexRequest { } } } - + SourceElementParser parser = this.manager.getSourceElementParser(javaProject, null/*requestor will be set by indexer*/); Object[] names = indexedFileNames.keyTable; Object[] values = indexedFileNames.valueTable; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexBinaryFolder.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexBinaryFolder.java index 88b80cd13..7e5633a0e 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexBinaryFolder.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexBinaryFolder.java @@ -99,8 +99,8 @@ public class IndexBinaryFolder extends IndexRequest { if (location != null) { String containerRelativePath = Util.relativePath(file.getFullPath(), IndexBinaryFolder.this.containerPath.segmentCount()); indexedFileNames.put(containerRelativePath, - indexedFileNames.get(containerRelativePath) == null - || indexLastModified < + indexedFileNames.get(containerRelativePath) == null + || indexLastModified < EFS.getStore(location).fetchInfo().getLastModified() ? (Object) file : (Object) OK); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java index 8d61692cb..41efb7e1e 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java @@ -93,7 +93,7 @@ public class IndexManager extends JobManager implements IIndexConstants { public static final Integer REBUILDING_STATE = 3; public static final Integer REUSE_STATE = 4; - private final IndexNamesRegistry nameRegistry = new IndexNamesRegistry(new File(getSavedIndexesDirectory(), + private final IndexNamesRegistry nameRegistry = new IndexNamesRegistry(new File(getSavedIndexesDirectory(), "savedIndexNames.txt"), getJavaPluginWorkingLocation()); //$NON-NLS-1$ // search participants who register indexes with the index manager private SimpleLookupTable participantsContainers = null; @@ -472,8 +472,8 @@ private SimpleLookupTable getIndexStates() { } } } else { - // All the index files are getting deleted and hence there is no need to - // further check for change in javaLikeNames. + // All the index files are getting deleted and hence there is no need to + // further check for change in javaLikeNames. writeJavaLikeNamesFile(); this.javaLikeNamesChanged = false; deleteIndexFiles(); @@ -499,12 +499,12 @@ private File getSavedIndexesDirectory() { /* * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=286379 * Returns true if there is a change in javaLikeNames since it - * has been last stored. - * The javaLikeNames stored in the file javaLikeNames.txt - * is compared with the current javaLikeNames and if there is a change, this - * function returns true. If the file javaLikeNames.txt doesn't exist and there - * is only one javaLikeName (.java), then this returns false so that no-reindexing - * happens. + * has been last stored. + * The javaLikeNames stored in the file javaLikeNames.txt + * is compared with the current javaLikeNames and if there is a change, this + * function returns true. If the file javaLikeNames.txt doesn't exist and there + * is only one javaLikeName (.java), then this returns false so that no-reindexing + * happens. */ private boolean hasJavaLikeNamesChanged() { char[][] currentNames = Util.getJavaLikeExtensions(); @@ -522,12 +522,12 @@ private boolean hasJavaLikeNamesChanged() { return true; } if (current > 1) { - // Sort the current java like names. + // Sort the current java like names. // Copy the array to avoid modifying the Util static variable System.arraycopy(currentNames, 0, currentNames = new char[current][], 0, current); Util.sort(currentNames); } - + // The JavaLikeNames would have been sorted before getting stored in the file, // hence just do a direct compare. for (int i = 0; i < current; i++) { @@ -550,12 +550,12 @@ public void indexDocument(SearchDocument searchDocument, SearchParticipant searc public void indexResolvedDocument(SearchDocument searchDocument, SearchParticipant searchParticipant, Index index, IPath indexLocation) { searchParticipant.resolveDocument(searchDocument); ReadWriteMonitor monitor = index.monitor; - if (monitor == null) + if (monitor == null) return; // index got deleted since acquired try { monitor.enterWrite(); // ask permission to write searchDocument.setIndex(index); - searchParticipant.indexResolvedDocument(searchDocument, indexLocation); + searchParticipant.indexResolvedDocument(searchDocument, indexLocation); } finally { searchDocument.setIndex(null); monitor.exitWrite(); @@ -640,7 +640,7 @@ public void indexLibrary(IPath path, IProject requestingProject, URL indexURL, f IndexRequest request = null; Object target = JavaModel.getTarget(path, true); if (target instanceof IFile) { - request = isJrt(((IFile) target).getFullPath().toOSString()) ? + request = isJrt(((IFile) target).getFullPath().toOSString()) ? new AddJrtToIndex((IFile) target, indexFile, this, forceIndexUpdate) : new AddJarFileToIndex((IFile) target, indexFile, this, forceIndexUpdate); } else if (target instanceof File) { @@ -719,7 +719,7 @@ public String processName(){ } private char[][] readJavaLikeNamesFile() { try { - String pathName = getJavaPluginWorkingLocation().toOSString(); + String pathName = getJavaPluginWorkingLocation().toOSString(); File javaLikeNamesFile = new File(pathName, "javaLikeNames.txt"); //$NON-NLS-1$ if (!javaLikeNamesFile.exists()) return null; @@ -755,7 +755,7 @@ private void rebuildIndex(IndexLocation indexLocation, IPath containerPath, fina } else if (target instanceof IFolder) { request = new IndexBinaryFolder((IFolder) target, this); } else if (target instanceof IFile) { - request = isJrt(((IFile) target).getFullPath().toOSString()) ? + request = isJrt(((IFile) target).getFullPath().toOSString()) ? new AddJrtToIndex((IFile) target, null, this, updateIndex) : new AddJarFileToIndex((IFile) target, null, this, updateIndex); } else if (target instanceof File) { @@ -1121,7 +1121,7 @@ private void readIndexMap() { this.indexLocations.put(new Path(new String(names[i+1])), indexPath ); this.indexStates.put(indexPath, REUSE_STATE); } - } + } } } catch (IOException ignored) { if (VERBOSE) @@ -1137,14 +1137,14 @@ private void readParticipantsIndexNamesFile() { char[][] names = CharOperation.splitOn('\n', participantIndexNames); if (names.length >= 3) { // First line is DiskIndex signature (see writeParticipantsIndexNamesFile()) - if (DiskIndex.SIGNATURE.equals(new String(names[0]))) { + if (DiskIndex.SIGNATURE.equals(new String(names[0]))) { for (int i = 1, l = names.length-1 ; i < l ; i+=2) { IndexLocation indexLocation = new FileIndexLocation(new File(new String(names[i])), true); containers.put(indexLocation, new Path(new String(names[i+1]))); } - } + } } - } + } } catch (IOException ignored) { if (VERBOSE) Util.verbose("Failed to read participant index file names"); //$NON-NLS-1$ @@ -1213,11 +1213,11 @@ public void updateParticipant(IPath indexPath, IPath containerPath) { private void writeJavaLikeNamesFile() { BufferedWriter writer = null; String pathName = getJavaPluginWorkingLocation().toOSString(); - try { + try { char[][] currentNames = Util.getJavaLikeExtensions(); int length = currentNames.length; if (length > 1) { - // Sort the current java like names. + // Sort the current java like names. // Copy the array to avoid modifying the Util static variable System.arraycopy(currentNames, 0, currentNames=new char[length][], 0, length); Util.sort(currentNames); @@ -1228,9 +1228,9 @@ private void writeJavaLikeNamesFile() { writer.write(currentNames[i]); writer.write('\n'); } - if (length > 0) + if (length > 0) writer.write(currentNames[length-1]); - + } catch (IOException ignored) { if (VERBOSE) Util.verbose("Failed to write javaLikeNames file", System.err); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexNamesRegistry.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexNamesRegistry.java index e9ec3562d..69eced365 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexNamesRegistry.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexNamesRegistry.java @@ -100,7 +100,7 @@ public class IndexNamesRegistry { } subMonitor.setWorkRemaining(newContents.length); - + try (BufferedWriter writer = new BufferedWriter(new FileWriter(this.savedIndexNamesFile))) { writer.write(DiskIndex.SIGNATURE); writer.write('+'); @@ -136,6 +136,6 @@ public class IndexNamesRegistry { synchronized (this.queueMutex) { this.pendingWrite = null; } - this.savedIndexNamesFile.delete(); + this.savedIndexNamesFile.delete(); } } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexingParser.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexingParser.java index be326c20b..46f5f2228 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexingParser.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexingParser.java @@ -35,7 +35,7 @@ public class IndexingParser extends SourceElementParser { super(requestor, problemFactory, options, reportLocalDeclarations, optimizeStringLiterals, useSourceJavadocParser); } - + @Override protected ImportReference newImportReference(char[][] tokens, long[] sourcePositions, boolean onDemand, int mod) { ImportReference ref = this.importReference; @@ -58,7 +58,7 @@ public class IndexingParser extends SourceElementParser { ref.sourceEnd = (int) positions; return ref; } - + @Override protected QualifiedNameReference newQualifiedNameReference(char[][] tokens, long[] positions, int sourceStart, int sourceEnd) { QualifiedNameReference ref = this.qualifiedNameReference; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java index d9d68c071..cc7141a44 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java @@ -84,7 +84,7 @@ public class SourceIndexer extends AbstractIndexer implements ITypeRequestor, Su private CompilationUnit compilationUnit; private CompilationUnitDeclaration cud; private static final boolean DEBUG = false; - + public SourceIndexer(SearchDocument document) { super(document); this.requestor = new SourceIndexerRequestor(this); @@ -109,7 +109,7 @@ public class SourceIndexer extends AbstractIndexer implements ITypeRequestor, Su } else { parser.setRequestor(this.requestor); } - + // Launch the parser char[] source = null; char[] name = null; @@ -130,7 +130,7 @@ public class SourceIndexer extends AbstractIndexer implements ITypeRequestor, Su } } } - + @Override public void accept(IBinaryType binaryType, PackageBinding packageBinding, AccessRestriction accessRestriction) { this.lookupEnvironment.createBinaryTypeFrom(binaryType, packageBinding, accessRestriction); @@ -152,9 +152,9 @@ public class SourceIndexer extends AbstractIndexer implements ITypeRequestor, Su SourceTypeElementInfo elementInfo = (SourceTypeElementInfo) sourceType; IType type = elementInfo.getHandle(); ICompilationUnit sourceUnit = (ICompilationUnit) type.getCompilationUnit(); - accept(sourceUnit, accessRestriction); + accept(sourceUnit, accessRestriction); } - + public void resolveDocument() { try { IPath path = new Path(this.document.getPath()); @@ -236,11 +236,11 @@ public class SourceIndexer extends AbstractIndexer implements ITypeRequestor, Su if (lambdaExpression.binding != null && lambdaExpression.binding.isValidBinding()) { final char[] superinterface = lambdaExpression.resolvedType.sourceName(); if (DEBUG) { - System.out.println('\t' + new String(superinterface) + '.' + + System.out.println('\t' + new String(superinterface) + '.' + new String(lambdaExpression.descriptor.selector) + "-> {}"); //$NON-NLS-1$ } SourceIndexer.this.addIndexEntry(IIndexConstants.METHOD_DECL, MethodPattern.createIndexKey(lambdaExpression.descriptor.selector, lambdaExpression.descriptor.parameters.length)); - + addClassDeclaration(0, // most entries are blank, that is fine, since lambda type/method cannot be searched. CharOperation.NO_CHAR, // package name ONE_ZERO, diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java index 3cb86c1b3..da3cb4a44 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java @@ -41,7 +41,7 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo char[][] enclosingTypeNames = new char[5][]; int depth = 0; int methodDepth = 0; - + public SourceIndexerRequestor(SourceIndexer indexer) { this.indexer = indexer; } @@ -165,7 +165,7 @@ public void acceptUnknownReference(char[] name, int sourcePosition) { private void addDefaultConstructorIfNecessary(TypeInfo typeInfo) { boolean hasConstructor = false; - + TypeDeclaration typeDeclaration = typeInfo.node; AbstractMethodDeclaration[] methods = typeDeclaration.methods; int methodCounter = methods == null ? 0 : methods.length; @@ -176,7 +176,7 @@ private void addDefaultConstructorIfNecessary(TypeInfo typeInfo) { break done; } } - + if (!hasConstructor) { this.indexer.addDefaultConstructorDeclaration( typeInfo.name, @@ -222,7 +222,7 @@ private void enterClass(TypeInfo typeInfo) { // eliminate possible qualifications, given they need to be fully resolved again if (typeInfo.superclass != null) { typeInfo.superclass = getSimpleName(typeInfo.superclass); - + // add implicit constructor reference to default constructor this.indexer.addConstructorReference(typeInfo.superclass, 0); } @@ -292,7 +292,7 @@ private void enterEnum(TypeInfo typeInfo) { for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++){ typeInfo.superinterfaces[i] = getSimpleName(typeInfo.superinterfaces[i]); } - } + } char[][] typeNames; if (this.methodDepth > 0) { typeNames = ONE_ZERO_CHAR; @@ -325,7 +325,7 @@ private void enterInterface(TypeInfo typeInfo) { for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++){ typeInfo.superinterfaces[i] = getSimpleName(typeInfo.superinterfaces[i]); } - } + } char[][] typeNames; if (this.methodDepth > 0) { typeNames = ONE_ZERO_CHAR; @@ -356,7 +356,7 @@ public void enterModule(ModuleInfo moduleInfo) { } } enterPackageVisibilityInfo(moduleInfo.exports); - enterPackageVisibilityInfo(moduleInfo.opens); + enterPackageVisibilityInfo(moduleInfo.opens); /* note: provides and uses directives processed automatically on IParser (SEParser) */ } private void enterPackageVisibilityInfo(ISourceElementRequestor.PackageExportInfo[] packInfos) { @@ -418,7 +418,7 @@ private static char[] getDeclaringQualification(TypeDeclaration typeDecl) { int l = nlist.size(); if (l == 1) return name; - + name = new char[size]; int index = 0; for (int i = 0; i < l - 1; ++i) { @@ -441,13 +441,13 @@ public void enterType(TypeInfo typeInfo) { case TypeDeclaration.CLASS_DECL: enterClass(typeInfo); break; - case TypeDeclaration.ANNOTATION_TYPE_DECL: + case TypeDeclaration.ANNOTATION_TYPE_DECL: enterAnnotationType(typeInfo); break; case TypeDeclaration.INTERFACE_DECL: enterInterface(typeInfo); break; - case TypeDeclaration.ENUM_DECL: + case TypeDeclaration.ENUM_DECL: enterEnum(typeInfo); break; case TypeDeclaration.RECORD_DECL: @@ -571,18 +571,18 @@ private void enterOTTypeInfo(char[] name, boolean isRoleFile) { public void enterCalloutMapping(CalloutInfo calloutInfo) { // TODO(SH): try to use new flag isDeclaration to decide what to do. - + // NOTE(jsv): if method specs without signature are used, we use Integer.MAX_VALUE to mark these methodSpecs - // NOTE(jsv): left methodSpec in a calloutMapping semantically represents a method declaration. + // NOTE(jsv): left methodSpec in a calloutMapping semantically represents a method declaration. // To guarantee consistency with MatchLocator we use methodRef category for all methodSpecs // TODO(jsv): use methodDecl category for role methodSpec in a callout mapping -> also change MathchLocator (method declaration should be reported (implementation for TPX-260 is needed!!)) // orig //this.indexer.addMethodDeclaration(leftSelector, leftParameterTypes, leftReturnType, null); - - int argCount= calloutInfo.left.parameterNames != null ? calloutInfo.left.parameterNames.length : Integer.MAX_VALUE; + + int argCount= calloutInfo.left.parameterNames != null ? calloutInfo.left.parameterNames.length : Integer.MAX_VALUE; this.indexer.addMethodReference(calloutInfo.left.selector, argCount); - - argCount = calloutInfo.right.parameterNames != null ? calloutInfo.right.parameterNames.length : Integer.MAX_VALUE; + + argCount = calloutInfo.right.parameterNames != null ? calloutInfo.right.parameterNames.length : Integer.MAX_VALUE; this.indexer.addMethodReference(calloutInfo.right.selector, argCount); } //must add right selector as field reference to indexer in case of callout to field @@ -591,7 +591,7 @@ public void enterCalloutToFieldMapping(CalloutToFieldInfo calloutInfo) { // TODO(SH): use new argument isDeclaration to decide what to do with left hand side. // TODO(SH): should new argument isSetter be evaluated? - int argCount = calloutInfo.left.parameterNames != null ? calloutInfo.left.parameterNames.length : Integer.MAX_VALUE; + int argCount = calloutInfo.left.parameterNames != null ? calloutInfo.left.parameterNames.length : Integer.MAX_VALUE; this.indexer.addMethodReference(calloutInfo.left.selector, argCount); this.indexer.addFieldReference(calloutInfo.rightSelector); } @@ -600,10 +600,10 @@ public void enterCalloutToFieldMapping(CalloutToFieldInfo calloutInfo) public void enterCallinMapping(CallinInfo callinInfo) { // TODO(SH): should new argument callinName be evaluated? - - int argCount = callinInfo.left.parameterNames != null ? callinInfo.left.parameterNames.length : Integer.MAX_VALUE; + + int argCount = callinInfo.left.parameterNames != null ? callinInfo.left.parameterNames.length : Integer.MAX_VALUE; this.indexer.addMethodReference(callinInfo.left.selector, argCount); - + for (int i = 0; i < callinInfo.right.length; i++) { MethodSpecInfo baseInfo= callinInfo.right[i]; argCount = baseInfo.parameterNames != null ? baseInfo.parameterNames.length : Integer.MAX_VALUE; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java index 85d2a798b..d77415c89 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java @@ -28,7 +28,7 @@ import org.eclipse.jdt.internal.core.search.indexing.IIndexConstants; public class ClassFileMatchLocator implements IIndexConstants { -private static final long TARGET_ANNOTATION_BITS = +private static final long TARGET_ANNOTATION_BITS = TagBits.AnnotationForType | TagBits.AnnotationForParameter | TagBits.AnnotationForPackage | @@ -192,7 +192,7 @@ public void locateMatches(MatchLocator locator, ClassFile classFile, IBinaryType int bFieldsLength = binaryFields == null ? 0 : binaryFields.length; IBinaryField[] unresolvedFields = null; boolean hasUnresolvedFields = false; - + // Report as many accurate matches as possible int accuracy = SearchMatch.A_ACCURATE; boolean mustResolve = pattern.mustResolve; @@ -371,7 +371,7 @@ private void matchAnnotations(SearchPattern pattern, MatchLocator locator, Class } } } - + // Look for references in fields annotations IBinaryField[] fields = binaryType.getFields(); if (fields != null) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClasspathSourceDirectory.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClasspathSourceDirectory.java index 8c84c06d5..ddc923041 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClasspathSourceDirectory.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClasspathSourceDirectory.java @@ -110,7 +110,7 @@ public boolean equals(Object o) { if (!(o instanceof ClasspathSourceDirectory)) return false; return this.sourceFolder.equals(((ClasspathSourceDirectory) o).sourceFolder); -} +} @Override public NameEnvironmentAnswer findClass(String typeName, String qualifiedPackageName, String moduleName, String qualifiedBinaryFileName, boolean asBinaryOnly, Predicate<String> moduleNameFilter) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java index ce2c02a39..6ef6c6e55 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java @@ -20,10 +20,10 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; public class ConstructorDeclarationPattern extends ConstructorPattern { public int extraFlags; - + public int declaringTypeModifiers; public char[] declaringPackageName; - + public int modifiers; public char[] signature; public char[][] parameterTypes; @@ -47,11 +47,11 @@ public void decodeIndexKey(char[] key) { int last = key.length - 1; int slash = CharOperation.indexOf(SEPARATOR, key, 0); this.declaringSimpleName = CharOperation.subarray(key, 0, slash); - + int start = slash + 1; slash = CharOperation.indexOf(SEPARATOR, key, start); last = slash - 1; - + boolean isDefaultConstructor = key[last] == '#'; if (isDefaultConstructor) { this.parameterCount = -1; @@ -67,23 +67,23 @@ public void decodeIndexKey(char[] key) { } } } - + slash = slash + 3; last = slash - 1; - + int typeModifiersWithExtraFlags = key[last-1] + (key[last]<<16); this.declaringTypeModifiers = decodeModifers(typeModifiersWithExtraFlags); this.extraFlags = decodeExtraFlags(typeModifiersWithExtraFlags); - + // initialize optional fields this.declaringPackageName = null; this.modifiers = 0; this.signature = null; this.parameterTypes = null; this.parameterNames = null; - + boolean isMemberType = (this.extraFlags & ExtraFlags.IsMemberType) != 0; - + if (!isMemberType) { start = slash + 1; if (this.parameterCount == -1) { @@ -93,19 +93,19 @@ public void decodeIndexKey(char[] key) { slash = CharOperation.indexOf(SEPARATOR, key, start); } last = slash - 1; - + this.declaringPackageName = CharOperation.subarray(key, start, slash); - + start = slash + 1; if (this.parameterCount == 0) { slash = slash + 3; last = slash - 1; - + this.modifiers = key[last-1] + (key[last]<<16); } else if (this.parameterCount > 0){ slash = CharOperation.indexOf(SEPARATOR, key, start); last = slash - 1; - + boolean hasParameterStoredAsSignature = (this.extraFlags & ExtraFlags.ParameterTypesStoredAsSignature) != 0; if (hasParameterStoredAsSignature) { this.signature = CharOperation.subarray(key, start, slash); @@ -116,20 +116,20 @@ public void decodeIndexKey(char[] key) { start = slash + 1; slash = CharOperation.indexOf(SEPARATOR, key, start); last = slash - 1; - + if (slash != start) { this.parameterNames = CharOperation.splitOn(PARAMETER_SEPARATOR, key, start, slash); } - + slash = slash + 3; last = slash - 1; - + this.modifiers = key[last-1] + (key[last]<<16); } else { this.modifiers = ClassFileConstants.AccPublic; } } - + removeInternalFlags(); // remove internal flags } @@ -144,10 +144,10 @@ public char[][] getIndexCategories() { @Override public boolean matchesDecodedKey(SearchPattern decodedPattern) { ConstructorDeclarationPattern pattern = (ConstructorDeclarationPattern) decodedPattern; - + // only top level types if ((pattern.extraFlags & ExtraFlags.IsMemberType) != 0) return false; - + // check package - exact match only if (this.declaringPackageName != null && !CharOperation.equals(this.declaringPackageName, pattern.declaringPackageName, true)) return false; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java index 54f0444e3..a196f3d0f 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java @@ -113,7 +113,7 @@ public int match(ReferenceExpression node, MatchingNodeSet nodeSet) { public int match(TypeDeclaration node, MatchingNodeSet nodeSet) { if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH; - if (this.pattern.fineGrain != 0 && + if (this.pattern.fineGrain != 0 && (this.pattern.fineGrain & ~IJavaSearchConstants.METHOD_REFERENCE_EXPRESSION) == 0 ) return IMPOSSIBLE_MATCH; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java index ffb36264b..f577af1e9 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java @@ -61,7 +61,7 @@ public final static int FINE_GRAIN_MASK = /** * Constructor entries are encoded as described - * + * * Binary constructor for class * TypeName '/' Arity '/' TypeModifers '/' PackageName '/' Signature '/' ParameterNamesopt '/' Modifiers * Source constructor for class @@ -72,7 +72,7 @@ public final static int FINE_GRAIN_MASK = * TypeName '/' # '/' TypeModifers '/' PackageName * Constructor for member type * TypeName '/' Arity '/' TypeModifers - * + * * TypeModifiers contains some encoded extra information * {@link ExtraFlags#IsMemberType} * {@link ExtraFlags#HasNonPrivateStaticMemberTypes} @@ -88,18 +88,18 @@ public static char[] createDeclarationIndexKey( char[] packageName, int typeModifiers, int extraFlags) { - + char[] countChars; char[] parameterTypesChars = null; char[] parameterNamesChars = null; - + if (argCount < 0) { countChars = DEFAULT_CONSTRUCTOR; } else { countChars = argCount < 10 ? COUNTS[argCount] : ("/" + String.valueOf(argCount)).toCharArray(); //$NON-NLS-1$ - + if (argCount > 0) { if (signature == null) { if (parameterTypes != null && parameterTypes.length == argCount) { @@ -112,58 +112,58 @@ public static char[] createDeclarationIndexKey( } else { extraFlags |= ExtraFlags.ParameterTypesStoredAsSignature; } - + if (parameterNames != null && parameterNames.length == argCount) { parameterNamesChars = CharOperation.concatWith(parameterNames, PARAMETER_SEPARATOR); } } } - + boolean isMemberType = (extraFlags & ExtraFlags.IsMemberType) != 0; - + int typeNameLength = typeName == null ? 0 : typeName.length; int packageNameLength = packageName == null ? 0 : packageName.length; int countCharsLength = countChars.length; int parameterTypesLength = signature == null ? (parameterTypesChars == null ? 0 : parameterTypesChars.length): signature.length; int parameterNamesLength = parameterNamesChars == null ? 0 : parameterNamesChars.length; - + int resultLength = typeNameLength + countCharsLength + 3; // SEPARATOR=1 + TypeModifers=2 if (!isMemberType) { resultLength += packageNameLength + 1; // SEPARATOR=1 if (argCount >= 0) { resultLength += 3; // SEPARATOR=1 + Modifiers=2 } - + if (argCount > 0) { resultLength += parameterTypesLength + parameterNamesLength + 2; //SEPARATOR=1 + SEPARATOR=1 } } - + char[] result = new char[resultLength]; - + int pos = 0; if (typeNameLength > 0) { System.arraycopy(typeName, 0, result, pos, typeNameLength); pos += typeNameLength; } - + if (countCharsLength > 0) { System.arraycopy(countChars, 0, result, pos, countCharsLength); pos += countCharsLength; } - + int typeModifiersWithExtraFlags = typeModifiers | encodeExtraFlags(extraFlags); result[pos++] = SEPARATOR; result[pos++] = (char) typeModifiersWithExtraFlags; result[pos++] = (char) (typeModifiersWithExtraFlags>>16); - + if (!isMemberType) { result[pos++] = SEPARATOR; if (packageNameLength > 0) { System.arraycopy(packageName, 0, result, pos, packageNameLength); pos += packageNameLength; } - + if (argCount == 0) { result[pos++] = SEPARATOR; result[pos++] = (char) modifiers; @@ -178,20 +178,20 @@ public static char[] createDeclarationIndexKey( } pos += parameterTypesLength; } - + result[pos++] = SEPARATOR; if (parameterNamesLength > 0) { System.arraycopy(parameterNamesChars, 0, result, pos, parameterNamesLength); pos += parameterNamesLength; } - + result[pos++] = SEPARATOR; result[pos++] = (char) modifiers; result[pos++] = (char) (modifiers>>16); } - + } - + return result; } public static char[] createDefaultDeclarationIndexKey( @@ -223,23 +223,23 @@ public static char[] createIndexKey(char[] typeName, int argCount) { } static int decodeExtraFlags(int modifiersWithExtraFlags) { int extraFlags = 0; - + if ((modifiersWithExtraFlags & ASTNode.Bit28) != 0) { extraFlags |= ExtraFlags.ParameterTypesStoredAsSignature; } - + if ((modifiersWithExtraFlags & ASTNode.Bit29) != 0) { extraFlags |= ExtraFlags.IsLocalType; } - + if ((modifiersWithExtraFlags & ASTNode.Bit30) != 0) { extraFlags |= ExtraFlags.IsMemberType; } - + if ((modifiersWithExtraFlags & ASTNode.Bit31) != 0) { extraFlags |= ExtraFlags.HasNonPrivateStaticMemberTypes; } - + return extraFlags; } static int decodeModifers(int modifiersWithExtraFlags) { @@ -247,33 +247,33 @@ static int decodeModifers(int modifiersWithExtraFlags) { } private static int encodeExtraFlags(int extraFlags) { int encodedExtraFlags = 0; - + if ((extraFlags & ExtraFlags.ParameterTypesStoredAsSignature) != 0) { encodedExtraFlags |= ASTNode.Bit28; } - + if ((extraFlags & ExtraFlags.IsLocalType) != 0) { encodedExtraFlags |= ASTNode.Bit29; } - + if ((extraFlags & ExtraFlags.IsMemberType) != 0) { encodedExtraFlags |= ASTNode.Bit30; } if ((extraFlags & ExtraFlags.HasNonPrivateStaticMemberTypes) != 0) { encodedExtraFlags |= ASTNode.Bit31; } - + return encodedExtraFlags; } private static char[] getTypeErasure(char[] typeName) { int index; if ((index = CharOperation.indexOf('<', typeName)) == -1) return typeName; - + int length = typeName.length; char[] typeErasurename = new char[length - 2]; System.arraycopy(typeName, 0, typeErasurename, 0, index); - + int depth = 1; for (int i = index + 1; i < length; i++) { switch (typeName[i]) { @@ -290,7 +290,7 @@ private static char[] getTypeErasure(char[] typeName) { break; } } - + System.arraycopy(typeErasurename, 0, typeErasurename = new char[index], 0, index); return typeErasurename; } @@ -349,18 +349,18 @@ public ConstructorPattern( * Instantiate a method pattern with signatures for generics search */ public ConstructorPattern( - char[] declaringSimpleName, + char[] declaringSimpleName, char[] declaringQualification, - char[][] parameterQualifications, + char[][] parameterQualifications, char[][] parameterSimpleNames, String[] parameterSignatures, IMethod method, int limitTo, int matchRule) { - this(declaringSimpleName, + this(declaringSimpleName, declaringQualification, - parameterQualifications, + parameterQualifications, parameterSimpleNames, limitTo, matchRule); @@ -411,19 +411,19 @@ public ConstructorPattern( * Instantiate a method pattern with signatures for generics search */ public ConstructorPattern( - char[] declaringSimpleName, + char[] declaringSimpleName, char[] declaringQualification, String declaringSignature, - char[][] parameterQualifications, + char[][] parameterQualifications, char[][] parameterSimpleNames, String[] parameterSignatures, char[][] arguments, int limitTo, int matchRule) { - this(declaringSimpleName, + this(declaringSimpleName, declaringQualification, - parameterQualifications, + parameterQualifications, parameterSimpleNames, limitTo, matchRule); @@ -462,13 +462,13 @@ public void decodeIndexKey(char[] key) { int last = key.length - 1; int slash = CharOperation.indexOf(SEPARATOR, key, 0); this.declaringSimpleName = CharOperation.subarray(key, 0, slash); - + int start = slash + 1; slash = CharOperation.indexOf(SEPARATOR, key, start); if (slash != -1) { last = slash - 1; } - + boolean isDefaultConstructor = key[last] == '#'; if (isDefaultConstructor) { this.parameterCount = -1; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java index 28862ae9c..a6811b913 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java @@ -96,7 +96,7 @@ public int match(FieldDeclaration node, MatchingNodeSet nodeSet) { public int match(MethodSpec node, MatchingNodeSet nodeSet) { int level = IMPOSSIBLE_MATCH; - + if (node instanceof FieldAccessSpec) { FieldAccessSpec fieldSpec = (FieldAccessSpec)node; @@ -187,7 +187,7 @@ protected void matchReportReference(ASTNode reference, IJavaElement element, IJa if (accuracy != SearchMatch.A_ACCURATE) return; // element that references the field must be included in the enclosing element - DeclarationOfAccessedFieldsPattern declPattern = (DeclarationOfAccessedFieldsPattern) this.pattern; + DeclarationOfAccessedFieldsPattern declPattern = (DeclarationOfAccessedFieldsPattern) this.pattern; while (element != null && !declPattern.enclosingElement.equals(element)) element = element.getParent(); if (element != null) { @@ -306,7 +306,7 @@ protected void updateMatch(ParameterizedTypeBinding parameterizedBinding, char[] protected void reportDeclaration(FieldBinding fieldBinding, MatchLocator locator, SimpleSet knownFields) throws CoreException { // ignore length field if (fieldBinding == ArrayBinding.ArrayLength) return; - + ReferenceBinding declaringClass = fieldBinding.declaringClass; IType type = locator.lookupType(declaringClass); if (type == null) return; // case of a secondary type @@ -337,7 +337,7 @@ protected void reportDeclaration(FieldBinding fieldBinding, MatchLocator locator fieldDecl = fieldDecls[i]; break; } - } + } if (fieldDecl != null) { int offset = fieldDecl.sourceStart; this.match = new FieldDeclarationMatch(((JavaElement) field).resolved(fieldBinding), SearchMatch.A_ACCURATE, offset, fieldDecl.sourceEnd-offset+1, locator.getParticipant(), resource); @@ -362,7 +362,7 @@ public int resolveLevel(ASTNode possiblelMatchingNode) { { return resolveLevel(((FieldAccessSpec)possiblelMatchingNode).resolvedField); } -//gbr} +//gbr} } if (possiblelMatchingNode instanceof FieldDeclaration) return matchField(((FieldDeclaration) possiblelMatchingNode).binding, true); @@ -375,7 +375,7 @@ public int resolveLevel(Binding binding) { // for matching the component in constructor of a record if ( ((LocalVariableBinding)binding).declaringScope.referenceContext() instanceof CompactConstructorDeclaration) { return matchLocal((LocalVariableBinding) binding, true); - } + } } if (!(binding instanceof FieldBinding)) return IMPOSSIBLE_MATCH; @@ -398,7 +398,7 @@ protected int resolveLevel(NameReference nameRef) { int level = matchField(fieldBinding, false); if (level != IMPOSSIBLE_MATCH) return level; } - } + } int otherMax = qNameRef.otherBindings == null ? 0 : qNameRef.otherBindings.length; for (int i = 0; i < otherMax; i++) { char[] token = qNameRef.tokens[i + qNameRef.indexOfFirstFieldBinding]; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java index 00bb4a11c..d7bdb9492 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java @@ -37,10 +37,10 @@ public static char[] createIndexKey(char[] fieldName) { } public FieldPattern( - char[] name, + char[] name, char[] declaringQualification, - char[] declaringSimpleName, - char[] typeQualification, + char[] declaringSimpleName, + char[] typeQualification, char[] typeSimpleName, int limitTo, int matchRule) { @@ -58,10 +58,10 @@ public FieldPattern( * Instantiate a field pattern with additional information for generic search */ public FieldPattern( - char[] name, + char[] name, char[] declaringQualification, - char[] declaringSimpleName, - char[] typeQualification, + char[] declaringSimpleName, + char[] typeQualification, char[] typeSimpleName, String typeSignature, int limitTo, diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/IndexBasedJavaSearchEnvironment.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/IndexBasedJavaSearchEnvironment.java index 7daca0c9a..1a6b369c7 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/IndexBasedJavaSearchEnvironment.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/IndexBasedJavaSearchEnvironment.java @@ -148,7 +148,7 @@ public class IndexBasedJavaSearchEnvironment implements INameEnvironment, Suffix AccessRestriction accessRestriction = ruleSet == null? null : ruleSet.getViolatedRestriction(binaryName); TypeRef typeRef = TypeRef.create(next); String fileName = new String(binaryName) + ".class"; //$NON-NLS-1$ - IBinaryType binaryType = new IndexBinaryType(typeRef, fileName.toCharArray()); + IBinaryType binaryType = new IndexBinaryType(typeRef, fileName.toCharArray()); NameEnvironmentAnswer nextAnswer = new NameEnvironmentAnswer(binaryType, accessRestriction); boolean useNewAnswer = isBetter(result, bestEntryPosition, nextAnswer, nextRoot); @@ -271,9 +271,9 @@ public class IndexBasedJavaSearchEnvironment implements INameEnvironment, Suffix public boolean isPackage(char[][] parentPackageName, char[] packageName) { char[] binaryPackageName = CharOperation.concatWith(parentPackageName, '/'); final char[] fieldDescriptorPrefix; - + if (parentPackageName == null || parentPackageName.length == 0) { - fieldDescriptorPrefix = CharArrayUtils.concat(JavaNames.FIELD_DESCRIPTOR_PREFIX, packageName, + fieldDescriptorPrefix = CharArrayUtils.concat(JavaNames.FIELD_DESCRIPTOR_PREFIX, packageName, new char[] { '/' }); } else { fieldDescriptorPrefix = CharArrayUtils.concat(JavaNames.FIELD_DESCRIPTOR_PREFIX, binaryPackageName, @@ -325,7 +325,7 @@ public class IndexBasedJavaSearchEnvironment implements INameEnvironment, Suffix public void cleanup() { // No explicit cleanup required for this class } - + public static INameEnvironment create(List<IJavaProject> javaProjects, org.eclipse.jdt.core.ICompilationUnit[] copies) { if (JavaIndex.isEnabled() && isEnabled()) { return new IndexBasedJavaSearchEnvironment(javaProjects, copies); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchNameEnvironment.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchNameEnvironment.java index 083fbc04f..751efcdd8 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchNameEnvironment.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchNameEnvironment.java @@ -160,8 +160,8 @@ private ClasspathLocation mapToClassPathLocation(JavaModelManager manager, Packa ClasspathEntry rawClasspathEntry = (ClasspathEntry) root.getRawClasspathEntry(); IJavaProject project = (IJavaProject) root.getParent(); String compliance = project.getOption(JavaCore.COMPILER_COMPLIANCE, true); - cp = (root instanceof JrtPackageFragmentRoot) ? - ClasspathLocation.forJrtSystem(path.toOSString(), rawClasspathEntry.getAccessRuleSet(), + cp = (root instanceof JrtPackageFragmentRoot) ? + ClasspathLocation.forJrtSystem(path.toOSString(), rawClasspathEntry.getAccessRuleSet(), ClasspathEntry.getExternalAnnotationPath(rawClasspathEntry, project.getProject(), true), compliance) : ClasspathLocation.forLibrary(manager.getZipFile(path), rawClasspathEntry.getAccessRuleSet(), ClasspathEntry.getExternalAnnotationPath(rawClasspathEntry, diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java index e213bf4d9..ba8650820 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java @@ -28,7 +28,7 @@ import org.eclipse.jdt.internal.core.util.Util; public class JavaSearchPattern extends SearchPattern implements IIndexConstants { - + /* * Whether this pattern is case sensitive. */ @@ -60,14 +60,14 @@ public class JavaSearchPattern extends SearchPattern implements IIndexConstants * Fine grain limitation */ public int fineGrain = 0; - + /** * Mask used on match rule for match mode. */ public static final int MATCH_MODE_MASK = R_EXACT_MATCH - | R_PREFIX_MATCH - | R_PATTERN_MATCH - | R_REGEXP_MATCH + | R_PREFIX_MATCH + | R_PATTERN_MATCH + | R_REGEXP_MATCH | R_CAMELCASE_MATCH | R_CAMELCASE_SAME_PART_COUNT_MATCH; @@ -216,7 +216,7 @@ public class JavaSearchPattern extends SearchPattern implements IIndexConstants } return null; } - + // Try to get the argument using the JavaModel info try { ITypeParameter[] parameters = method.getTypeParameters(); @@ -270,13 +270,13 @@ public class JavaSearchPattern extends SearchPattern implements IIndexConstants public final boolean hasTypeParameters() { return !hasSignatures() && hasTypeArguments(); } - + /** * Return whether two suffixes are compatible. - * + * * Note that obvious compatibility values as equals and {@link IIndexConstants#TYPE_SUFFIX} * has to be tested by caller to avoid unnecessary method call... - * + * * @param typeSuffix * @param patternSuffix * @return true if suffixes are compatible, false otherwise @@ -329,7 +329,7 @@ public class JavaSearchPattern extends SearchPattern implements IIndexConstants } return false; } - + // Default behavior is to match suffixes return true; } @@ -342,7 +342,7 @@ public class JavaSearchPattern extends SearchPattern implements IIndexConstants output.append("\", "); //$NON-NLS-1$ } switch(getMatchMode()) { - case R_EXACT_MATCH : + case R_EXACT_MATCH : output.append("exact match, "); //$NON-NLS-1$ break; case R_PREFIX_MATCH : diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/LocalVariablePattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/LocalVariablePattern.java index 49b343c4c..7bd60b0f5 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/LocalVariablePattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/LocalVariablePattern.java @@ -27,7 +27,7 @@ import org.eclipse.jdt.internal.core.search.JavaSearchScope; import org.eclipse.jdt.internal.core.util.Util; public class LocalVariablePattern extends VariablePattern { - + LocalVariable localVariable; public LocalVariablePattern(LocalVariable localVariable, int limitTo, int matchRule) { @@ -45,7 +45,7 @@ public void findIndexMatches(Index index, IndexQueryRequestor requestor, SearchP IModuleDescription md = root.getModuleDescription(); if(md != null) { String module = md.getElementName(); - documentPath = root.getPath() + IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR + documentPath = root.getPath() + IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR + module + IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR + relativePath; } else { documentPath = root.getPath() + IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR + relativePath; @@ -62,11 +62,11 @@ public void findIndexMatches(Index index, IndexQueryRequestor requestor, SearchP // Note that requestor has to verify if needed whether the document violates the access restriction or not AccessRuleSet access = javaSearchScope.getAccessRuleSet(relativePath, index.containerPath); if (access != JavaSearchScope.NOT_ENCLOSED) { // scope encloses the path - if (!requestor.acceptIndexMatch(documentPath, this, participant, access)) + if (!requestor.acceptIndexMatch(documentPath, this, participant, access)) throw new OperationCanceledException(); } } else if (scope.encloses(documentPath)) { - if (!requestor.acceptIndexMatch(documentPath, this, participant, null)) + if (!requestor.acceptIndexMatch(documentPath, this, participant, null)) throw new OperationCanceledException(); } } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java index 3269223e2..053d15c3b 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java @@ -117,37 +117,37 @@ import org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transfor /** * OTDT changes: - * + * * What: Harnessing of all compiler calls with Dependencies (throughout) * * Retrenching several mangled names/signatures: * --------------------------------------------- * What: retrench signature of callin method * How: use MethodSignatureEnhancer.getSourceArguments(method); - * + * * What: Strip leading __OT__ - * Where: + * Where: * - createHandle(AbstractMethodDeclaration method, ...) if method is a ctor * - reportMatching(TypeDeclaration type, ...) * * What: when matching methods: * - filter generated methods * - look in interface part, too - * + * * Handle new elements: * -------------------- * What: account for a new kind of variable: TYPE_VALUE_PARAMETER. - * + * * What: Support matching "team package" decl as a type reference - * + * * What: report matching of new node kinds: * - base class * - method mappings - * + * * What: Acount for OTJavaElement * How: Before casting to JavaElement check whether we should actually use OTJavaElement - * - * + * + * * ROFI: * ----- * What: Account for role files when traversing type declarations @@ -393,7 +393,7 @@ public MatchLocator( this.sourceStartOfMethodToRetain = range.getOffset(); this.sourceEndOfMethodToRetain = this.sourceStartOfMethodToRetain + range.getLength() - 1; // offset is 0 based. } catch (JavaModelException e) { - // drop silently. + // drop silently. } } } @@ -425,7 +425,7 @@ public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestrict CompilationUnitDeclaration parsedUnit = basicParser().dietParse(sourceUnit, unitResult); //{ObjectTeams: never try to get this unit's method bodies: parsedUnit.parseMethodBodies = false; -// SH} +// SH} this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction); this.lookupEnvironment.completeTypeBindings(parsedUnit, true); } catch (AbortCompilationUnit e) { @@ -562,7 +562,7 @@ protected IJavaElement createHandle(AbstractMethodDeclaration method, IJavaEleme //{ObjectTeams: retrench signature of callin method: /* orig: Argument[] arguments = method.arguments; - :giro */ + :giro */ Argument[] arguments = MethodSignatureEnhancer.getSourceArguments(method, this.options.weavingScheme); // SH} int argCount = arguments == null ? 0 : arguments.length; @@ -625,12 +625,12 @@ protected IJavaElement createHandle(AbstractMethodDeclaration method, IJavaEleme parameterTypeSignatures[i] = Signature.createTypeSignature(typeName, false); } } -//{ObjectTeams: be sure to use correct selectors even for role constructors (with __OT__) +//{ObjectTeams: be sure to use correct selectors even for role constructors (with __OT__) String selector = new String(method.selector); - if (method.isConstructor()) + if (method.isConstructor()) selector = parent.getElementName(); return createMethodHandle(type, selector, parameterTypeSignatures); -/* orig: +/* orig: return createMethodHandle(type, new String(method.selector), parameterTypeSignatures); :giro */ //jsv,gbr+SH} @@ -741,7 +741,7 @@ protected IJavaElement createHandle(AbstractVariableDeclaration variableDeclarat case AbstractVariableDeclaration.TYPE_VALUE_PARAMETER: if (!(parent instanceof IType)) return parent; return ((IType) parent).getField(new String(variableDeclaration.name)); -// SH} +// SH} } return null; } @@ -890,15 +890,15 @@ public boolean encloses(IJavaElement element) { if (element != null) { if (this.scope instanceof HierarchyScope) return ((HierarchyScope)this.scope).encloses(element, this.progressMonitor); - else + else return this.scope.encloses(element); } return false; } private boolean filterEnum(SearchMatch match) { - - // filter org.apache.commons.lang.enum package for projects above 1.5 - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=317264 + + // filter org.apache.commons.lang.enum package for projects above 1.5 + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=317264 IJavaElement element = (IJavaElement)match.getElement(); PackageFragment pkg = (PackageFragment)element.getAncestor(IJavaElement.PACKAGE_FRAGMENT); if (pkg != null) { @@ -1120,7 +1120,7 @@ private int getMaxResult(int[][] resultsMap) { for (int i = 1; i < rows; ++i) { int tmp = resultsMap[i][j]; if (tmp < current) continue; - if (tmp > current) { + if (tmp > current) { current = tmp; candidates.clear(); } @@ -1131,7 +1131,7 @@ private int getMaxResult(int[][] resultsMap) { return candidates.get(0); } -/** apply the function to map the parameter full name to an index +/** apply the function to map the parameter full name to an index */ private int mapParameter(List <String> patternParameterFullName, List <String> methodParameterFullName) { int patternLen = patternParameterFullName.size(); @@ -1625,7 +1625,7 @@ public void locateMatches(SearchDocument[] searchDocuments) throws CoreException JavaModelManager.getLocalFile(path).toPath().toAbsolutePath().toString() : pathString.split(Pattern.quote("|"))[0]; //$NON-NLS-1$ possibleMatch.autoModuleName = new String(AutomaticModuleNaming.determineAutomaticModuleName(s)); - } + } } // last project @@ -1679,7 +1679,7 @@ private Openable getCloserOpenable(Openable openable, String pathString) { if (jpkf.getModuleDescription() != null && CompilerOptions.versionToJdkLevel(javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true)) < ClassFileConstants.JDK9) { - openable = this.handleFactory.createOpenable(pathString, + openable = this.handleFactory.createOpenable(pathString, getSubScope(JavaCore.COMPILER_COMPLIANCE, ClassFileConstants.JDK9, false)); } } @@ -2030,13 +2030,13 @@ protected boolean parseAndBuildBindings(PossibleMatch possibleMatch, boolean mus /* orig: try { :giro */ - try (Config config = ( mustResolve + try (Config config = ( mustResolve || (this.patternLocator.mayBeGeneric && possibleMatch.nodeSet.mustResolve)) ? Dependencies.setup(this, this.parser, this.lookupEnvironment, true, true) - : null) + : null) { //SH} - + if (BasicSearchEngine.VERBOSE) System.out.println("Parsing " + possibleMatch.openable.toStringWithAncestors()); //$NON-NLS-1$ @@ -2047,7 +2047,7 @@ protected boolean parseAndBuildBindings(PossibleMatch possibleMatch, boolean mus if (parsedUnit.isModuleInfo()) { if (mustResolve) { this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/); - } + } } else if (!parsedUnit.isEmpty()) { if (mustResolve) { this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/); @@ -2056,8 +2056,8 @@ protected boolean parseAndBuildBindings(PossibleMatch possibleMatch, boolean mus //{ObjectTeams: Note(SH): // Do not use Dependencies here as not to trigger completeTypeBindings. // This way we avoid triggering accept which in turn processed the CU to the point that -// we found "duplicate type" which then caused hasAlreadyDefinedType() above to bail out. -// SH} +// we found "duplicate type" which then caused hasAlreadyDefinedType() above to bail out. +// SH} getMethodBodies(parsedUnit, possibleMatch.nodeSet); if (this.patternLocator.mayBeGeneric && !mustResolve && possibleMatch.nodeSet.mustResolve) { // special case: possible match node set force resolution although pattern does not @@ -2151,7 +2151,7 @@ protected void process(PossibleMatch possibleMatch, boolean bindingsWereCreated) unit.resolve(); :giro */ Dependencies.ensureState(unit, ITranslationStates.STATE_LATE_ELEMENTS_COPIED); -// SH,carp} +// SH,carp} } else if (unit.isPackageInfo()) { if (BasicSearchEngine.VERBOSE) System.out.println("Resolving " + this.currentPossibleMatch.openable.toStringWithAncestors()); //$NON-NLS-1$ @@ -2216,7 +2216,7 @@ protected void purgeMethodStatements(TypeDeclaration type, boolean checkEachMeth TypeDeclaration[] memberTypes = type.memberTypes; if (memberTypes != null) for (int i = 0, l = memberTypes.length; i < l; i++) -//{ObjectTeams: don't purge role files via their containing team +//{ObjectTeams: don't purge role files via their containing team // (need to traverse them via their own CompilationUnitDeclaration). if (!memberTypes[i].isRoleFile()) // SH} @@ -2655,7 +2655,7 @@ protected void reportMatching(LambdaExpression lambdaExpression, IJavaElement p ASTNode[] nodes = typeInHierarchy ? nodeSet.matchingNodes(lambdaExpression.sourceStart, lambdaExpression.sourceEnd) : null; boolean report = (this.matchContainer & PatternLocator.METHOD_CONTAINER) != 0 && encloses(enclosingElement); MemberDeclarationVisitor declarationVisitor = new MemberDeclarationVisitor(enclosingElement, report ? nodes : null, nodeSet, this, typeInHierarchy); - + if (lambdaExpression.arguments != null) { int argumentsLength = lambdaExpression.arguments.length; for (int i = 0; i < argumentsLength; i++) @@ -2665,7 +2665,7 @@ protected void reportMatching(LambdaExpression lambdaExpression, IJavaElement p if (lambdaExpression.body != null) { lambdaExpression.body.traverse(declarationVisitor, (BlockScope) null); } - + // Report all nodes and remove them if (nodes != null) { int length = nodes.length; @@ -2889,8 +2889,8 @@ private void reportMatching(Annotation[][] annotationsList, IJavaElement enclosi if (annotationsList != null) { for (int i = 0, length = annotationsList.length; i < length; ++i) { Annotation[] annotations = annotationsList[i]; - if (annotations != null) - reportMatching(annotations, enclosingElement, null, binding, nodeSet, matchedClassContainer, encloses(enclosingElement)); + if (annotations != null) + reportMatching(annotations, enclosingElement, null, binding, nodeSet, matchedClassContainer, encloses(enclosingElement)); } } } @@ -2994,13 +2994,13 @@ protected void reportMatching(CompilationUnitDeclaration unit, boolean mustResol } } } -//{ObjectTeams: ROFI: special node: the package declaration interpreted as a type reference +//{ObjectTeams: ROFI: special node: the package declaration interpreted as a type reference if (pkg != null && (pkg.modifiers & ExtraCompilerModifiers.AccTeam) != 0) { Integer level = (Integer) nodeSet.matchingNodes.removeKey(pkg); if (level != null) this.patternLocator.matchReportImportRef(pkg, null/*no binding*/, createImportHandle(pkg), level.intValue(), this); } -// SH} +// SH} } TypeDeclaration[] types = unit.types; @@ -3279,8 +3279,8 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc // in case, role splitting had not taken place: String typeName = new String(type.name); boolean isRole = false; - if ( type.isRole() - && !type.isInterface() + if ( type.isRole() + && !type.isInterface() && typeName.startsWith(IOTConstants.OT_DELIM)) { typeName = typeName.substring(IOTConstants.OT_DELIM_LEN); @@ -3291,13 +3291,13 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc enclosingElement = createTypeHandle(new String(type.name)); } else if (enclosingElement instanceof IType) { enclosingElement = ((IType) parent).getType(new String(type.name)); - :giro */ + :giro */ if (enclosingElement == null) { enclosingElement = createTypeHandle(typeName); } else if (enclosingElement instanceof IType) { - if (isRole) + if (isRole) enclosingElement = TypeHelper.findRoleType((IType)parent, typeName); // FIXME(SH): avoid heavy weight operation here! - else + else enclosingElement = ((IType) parent).getType(new String(type.name)); // jsv,gbr,SH} } else if (enclosingElement instanceof IMember) { @@ -3311,7 +3311,7 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc if ((type.bits & ASTNode.IsAnonymousType) != 0) { if (fileName != null) { if (fileName.endsWith("jar") || fileName.endsWith(SuffixConstants.SUFFIX_STRING_class)) { //$NON-NLS-1$ - IOrdinaryClassFile classFile= binaryType.getPackageFragment().getOrdinaryClassFile(binaryType.getTypeQualifiedName() + + IOrdinaryClassFile classFile= binaryType.getPackageFragment().getOrdinaryClassFile(binaryType.getTypeQualifiedName() + "$" + Integer.toString(occurrenceCount) + SuffixConstants.SUFFIX_STRING_class);//$NON-NLS-1$ anonType = classFile.getType(); } @@ -3381,7 +3381,7 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc for (int i = 0, length = superClass.annotations == null ? 0 : superClass.annotations.length; i < length; i++) { Annotation[] annotations = superClass.annotations[i]; if (annotations == null) continue; - reportMatching(annotations, enclosingElement, null, type.binding, nodeSet, matchedClassContainer, enclosesElement); + reportMatching(annotations, enclosingElement, null, type.binding, nodeSet, matchedClassContainer, enclosesElement); } } TypeReference[] superInterfaces = type.superInterfaces; @@ -3393,9 +3393,9 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc if (annotations != null) { for (int j = 0, length = annotations.length; j < length; j++) { if (annotations[j] == null) continue; - reportMatching(annotations[j], enclosingElement, null, type.binding, nodeSet, matchedClassContainer, enclosesElement); + reportMatching(annotations[j], enclosingElement, null, type.binding, nodeSet, matchedClassContainer, enclosesElement); } - } + } } } } @@ -3416,12 +3416,12 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc if (nameRef == null) continue; Integer level = (Integer) nodeSet.matchingNodes.removeKey(nameRef); if (level != null && matchedClassContainer) - this.patternLocator.matchReportReference(nameRef, enclosingElement, type.binding, level.intValue(), this); + this.patternLocator.matchReportReference(nameRef, enclosingElement, type.binding, level.intValue(), this); } } } -//jsv,gbr} - +//jsv,gbr} + // filter out element not in hierarchy scope boolean typeInHierarchy = type.binding == null || typeInHierarchy(type.binding); matchedClassContainer = matchedClassContainer && typeInHierarchy; @@ -3436,12 +3436,12 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc for (int i = 0; i < length; i++) { FieldDeclaration field = fields[i]; //{ObjectTeams: filter all generated fields - if (field.copyInheritanceSrc != null || + if (field.copyInheritanceSrc != null || Flags.isSynthetic(field.modifiers)) { continue; } -//jsv,gbr} +//jsv,gbr} boolean last = field.endPart2Position == 0 || field.declarationEnd == field.endPart2Position; // Store first index of multiple field declaration if (!last) { @@ -3482,14 +3482,14 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc if (nodeSet.matchingNodes.elementSize == 0) return; // end as all matching nodes were reported for (int i = 0, l = methods.length; i < l; i++) { AbstractMethodDeclaration method = methods[i]; -//{ObjectTeams: filter generated methods: +//{ObjectTeams: filter generated methods: if (isRelevantMethod(method)) { // orig: Integer level = (Integer) nodeSet.matchingNodes.removeKey(method); -// :giro +// :giro // if method was not found in nodeSet also check its interface part // (yet reporting the class part method): - if (level == null && method.interfacePartMethod != null) + if (level == null && method.interfacePartMethod != null) level = (Integer) nodeSet.matchingNodes.removeKey(method.interfacePartMethod); // orig: int value = (level != null && matchedClassContainer) ? level.intValue() : -1; @@ -3513,11 +3513,11 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc AbstractMethodMappingDeclaration mapping = mappings[idx]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(mapping); int value = (level != null && matchedClassContainer) ? level.intValue() : -1; - reportMatching(mappings[idx], enclosingElement, mapping.binding, value, typeInHierarchy, nodeSet); + reportMatching(mappings[idx], enclosingElement, mapping.binding, value, typeInHierarchy, nodeSet); } } //gbr} - + // Visit types TypeDeclaration[] memberTypes = type.memberTypes; if (memberTypes != null) { @@ -3533,7 +3533,7 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc } if (memberType.isRoleFile()) continue; // role files are traversed from their CUD, not as member of the team -//jsv,gbr} +//jsv,gbr} Integer level = (Integer) nodeSet.matchingNodes.removeKey(memberType); int value = (level != null && matchedClassContainer) ? level.intValue() : -1; reportMatching(memberType, enclosingElement, value, nodeSet, 1); @@ -3541,7 +3541,7 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc } } -//{ObjectTeams: report method mapping declaration or references in this method mapping declaration +//{ObjectTeams: report method mapping declaration or references in this method mapping declaration /** * Visit the given method mapping declaration and report the nodes in its range that match exactly the * search pattern (i.e. the ones in the matching nodes set) @@ -3552,31 +3552,31 @@ protected void reportMatching( Binding binding, int accuracy, boolean typeInHierarchy, - MatchingNodeSet nodeSet) throws CoreException + MatchingNodeSet nodeSet) throws CoreException { IJavaElement enclosingElement = createHandle(methodMapping, parent); if (accuracy > -1) { System.out.println("FIXME: MatchLocator.reportMatching(): accuracy: " + accuracy); - //TODO(gbr,jsv) handle declaration of method mapping if it is searched + //TODO(gbr,jsv) handle declaration of method mapping if it is searched } - + // boolean matchedMethodContainer = (this.matchContainer & PatternLocator.METHOD_CONTAINER) != 0; // //TODO(gbr) The role method spec in a callout binding is always a declaration. // //The following code always returns a reference match for a method spec, even if // //declarations of a method are searched. The reason is that a "MethodSpec" doesn' t contain // //the information, if it is a reference (message send) or a (method) declaration. // if (methodMapping instanceof CalloutMappingDeclaration) -// { +// { // MethodSpec roleMethodSpec = methodMapping.roleMethodSpec; // Integer level = (Integer) nodeSet.matchingNodes.removeKey(roleMethodSpec); // int value = (level != null && matchedMethodContainer) ? level.intValue() : -1; -// +// // if (value > -1) { // enclosingElement = createHandle(roleMethodSpec, parent); // if (enclosingElement != null) { // skip if unable to find method -// // compute source positions of the selector +// // compute source positions of the selector // Scanner scanner = parser.scanner; // int nameSourceStart = roleMethodSpec.sourceStart; // scanner.setSource(this.currentPossibleMatch.getContents()); @@ -3591,10 +3591,10 @@ protected void reportMatching( // SearchMatch match = newDeclarationMatch(enclosingElement, accuracy, nameSourceStart, length); // report(match); // } -// } +// } // } // } - + if (typeInHierarchy) { int start = methodMapping.declarationSourceStart; int end = methodMapping.declarationSourceEnd; @@ -3608,8 +3608,8 @@ protected void reportMatching( for (int i=0; i<roleArgs.length; i++) { TypeReference argType = roleArgs[i].type; if ( argType.resolvedType != null - && argType.resolvedType.isRole() - && methodMapping.roleMethodSpec.argNeedsTranslation(i)) + && argType.resolvedType.isRole() + && methodMapping.roleMethodSpec.argNeedsTranslation(i)) { Integer level = (Integer) nodeSet.matchingNodes.removeKey(argType); if (level != null) @@ -3628,7 +3628,7 @@ protected void reportMatching( { Integer level = (Integer) nodeSet.matchingNodes.removeKey(returnType); if (level != null) - this.patternLocator.matchReportReference(returnType, enclosingElement, binding, level.intValue()|SearchMatch.A_CHECKED, this); + this.patternLocator.matchReportReference(returnType, enclosingElement, binding, level.intValue()|SearchMatch.A_CHECKED, this); } } } @@ -3660,36 +3660,36 @@ protected void reportMatching( //{ObjectTeams: filter all generated methods private boolean isRelevantMethod(AbstractMethodDeclaration method) { - if ( method.isCopied + if ( method.isCopied || Flags.isSynthetic(method.modifiers)) { return false; } - if (method.isGenerated) + if (method.isGenerated) return method.isReusingSourceMethod; // callout or guard: generated but declaration is present in src return true; } -//jsv,gbr moved by SH} +//jsv,gbr moved by SH} //{ObjectTeams: new method /** - * Creates an IJavaElement from the given method mapping declaration and type. + * Creates an IJavaElement from the given method mapping declaration and type. */ protected IJavaElement createHandle( AbstractMethodMappingDeclaration mappingDecl, IJavaElement parent) throws JavaModelException -{ +{ if (!(parent instanceof IType)) { return parent; } - + IType parentType = (IType) parent; // if (!parentType.exists()) // if necessary, create elementInfo FIXME (carp) // return null; - + RoleType roleType = (RoleType)OTModelManager.getOTElement(parentType); - + if (roleType != null) { if (mappingDecl instanceof CalloutMappingDeclaration) @@ -3747,7 +3747,7 @@ protected void reportMatching(TypeParameter[] typeParameters, IJavaElement enclo } boolean matchedClassContainer = (this.matchContainer & PatternLocator.ALL_CONTAINER) != 0; if (typeParameter.annotations != null) { - reportMatching(typeParameter.annotations, enclosingElement, null, typeParameter.binding, nodeSet, matchedClassContainer, encloses(enclosingElement)); + reportMatching(typeParameter.annotations, enclosingElement, null, typeParameter.binding, nodeSet, matchedClassContainer, encloses(enclosingElement)); } if (typeParameter.type != null) { reportMatching(typeParameter.type.annotations, enclosingElement, typeParameter.binding, nodeSet, matchedClassContainer); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java index acedabcdf..6eafca71d 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java @@ -128,7 +128,7 @@ public class ClassButNoMethodDeclarationVisitor extends ASTVisitor { MatchLocatorParser.this.patternLocator.match(paramMapping, MatchLocatorParser.this.nodeSet); return true; } - + @Override public boolean visit(MethodSpec methodSpec, BlockScope scope) { @@ -681,7 +681,7 @@ protected void consumeParameterMappingOut() protected void consumeCallinBindingLeft(boolean hasSignature) { super.consumeCallinBindingLeft(hasSignature); // role args can cause lifting -> interpret as class instance creation: - if (hasSignature && (this.patternFineGrain & IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE) != 0) + if (hasSignature && (this.patternFineGrain & IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE) != 0) { CallinMappingDeclaration callinDecl = (CallinMappingDeclaration) this.astStack[this.astPtr]; Argument[] roleArgs = callinDecl.roleMethodSpec.arguments; @@ -694,7 +694,7 @@ protected void consumeCallinBindingLeft(boolean hasSignature) { protected void consumeCalloutBindingLeft(boolean hasSignature) { super.consumeCalloutBindingLeft(hasSignature); // role return can cause lifting -> interpret as class instance creation: - if (hasSignature && (this.patternFineGrain & IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE) != 0) + if (hasSignature && (this.patternFineGrain & IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE) != 0) { CalloutMappingDeclaration callinDecl = (CalloutMappingDeclaration) this.astStack[this.astPtr]; this.patternLocator.match(callinDecl.roleMethodSpec.returnType, this.nodeSet); @@ -793,7 +793,7 @@ protected void consumeReferenceExpression(ReferenceExpression referenceExpressio } else if (referenceExpression.lhs instanceof QualifiedNameReference || referenceExpression.lhs instanceof QualifiedTypeReference) { if ((this.patternFineGrain & IJavaSearchConstants.QUALIFIED_REFERENCE) != 0) { this.patternLocator.match(referenceExpression, this.nodeSet); - } + } } } @@ -1083,7 +1083,7 @@ protected TypeReference augmentTypeWithAdditionalDimensions(TypeReference typeRe @Override protected TypeReference getTypeReference(int dim) { //{ObjectTeams: wrap to introduce 2nd parameter - return getTypeReference(dim, false); + return getTypeReference(dim, false); } @Override protected TypeReference getTypeReference(int dim, boolean liftingTypeAllowed) { @@ -1155,9 +1155,9 @@ public void parseBodies(CompilationUnitDeclaration unit) { this.patternLocator.match(type, this.nodeSet); this.parseBodies(type, unit); } -//{ObjectTeams: prevent duplicate parsing: +//{ObjectTeams: prevent duplicate parsing: unit.bits |= ASTNode.HasAllMethodBodies; -// SH} +// SH} } /** * Parses the member bodies in the given type. @@ -1182,7 +1182,7 @@ protected void parseBodies(TypeDeclaration type, CompilationUnitDeclaration unit AbstractMethodMappingDeclaration mapping = mappings[i]; mapping.parseParamMappings(this, unit); mapping.traverse(this.localDeclarationVisitor, (ClassScope) null); - } + } } //carp} @@ -1213,15 +1213,15 @@ protected void parseBodies(TypeDeclaration type, CompilationUnitDeclaration unit } } - //TODO(jwl): Do we need to support anonymous inner types in method mapping, i.e. actually + //TODO(jwl): Do we need to support anonymous inner types in method mapping, i.e. actually // contained within a block of the parameter mapping? - + TypeDeclaration[] memberTypes = type.memberTypes; if (memberTypes != null) { for (int i = 0; i < memberTypes.length; i++) { TypeDeclaration memberType = memberTypes[i]; //{ObjectTeams: don't consider role files: -// MatchLocator.getMethodBodies() calls scanner.setSource() with the original, +// MatchLocator.getMethodBodies() calls scanner.setSource() with the original, // untransformed source of the Compilation_Unit_, which contains no RoleFiles anyway. // Skipping them prevents an ArrayIndexOutOfBoundsException in the Scanner, later. // Role files are handled through their own CompilationUnit. @@ -1233,7 +1233,7 @@ protected void parseBodies(TypeDeclaration type, CompilationUnitDeclaration unit // and right after that, traversing it a second time through memberType.traverse(). // Some hints(SH): // + parseBodies is needed to do the parsing ;-) - // + memberType.traverse(..) is needed to visit the memberType itself + // + memberType.traverse(..) is needed to visit the memberType itself // which is not part of the recursive parseBodies. // Also the localDeclarationVisitor might only process a very limited set of ast nodes. // So, the calls do have different effect, how much redundancy remains, I can't definitely say. diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchingNodeSet.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchingNodeSet.java index d6a3d86a9..b6b199b16 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchingNodeSet.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchingNodeSet.java @@ -93,7 +93,7 @@ public void addPossibleMatch(ASTNode node) { // see http://bugs.eclipse.org/bugs/show_bug.cgi?id=29366) long key = (((long) node.sourceStart) << 32) + node.sourceEnd; ASTNode existing = (ASTNode) this.possibleMatchingNodesKeys.get(key); -//{ObjectTeams: also expect a type reference to replace a name reference when a type anchor +//{ObjectTeams: also expect a type reference to replace a name reference when a type anchor // is converted to a type annotation (see Parser#convertTypeAnchor()): /* orig: if (existing != null && existing.getClass().equals(node.getClass())) @@ -108,7 +108,7 @@ public void addPossibleMatch(ASTNode node) { } public void addTrustedMatch(ASTNode node, boolean isExact) { addTrustedMatch(node, isExact ? EXACT_MATCH : POTENTIAL_MATCH); - + } void addTrustedMatch(ASTNode node, Integer level) { // remove existing node at same position from set @@ -118,7 +118,7 @@ void addTrustedMatch(ASTNode node, Integer level) { ASTNode existing = (ASTNode) this.matchingNodesKeys.get(key); if (existing != null && existing.getClass().equals(node.getClass())) this.matchingNodes.removeKey(existing); - + // map node to its accuracy level this.matchingNodes.put(node, level); this.matchingNodesKeys.put(key, node); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MemberDeclarationVisitor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MemberDeclarationVisitor.java index 90dcfd98f..adca9369a 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MemberDeclarationVisitor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MemberDeclarationVisitor.java @@ -226,7 +226,7 @@ public boolean visit(LambdaExpression lambdaExpression, BlockScope scope) { if (lambdaExpression.resolvedType != null && lambdaExpression.resolvedType.isValidBinding() && !(lambdaExpression.descriptor instanceof ProblemMethodBinding)) this.locator.reportMatching(lambdaExpression, this.enclosingElement, level != null ? level.intValue() : -1, this.nodeSet, this.typeInHierarchy); - else + else return true; } catch (CoreException e) { throw new WrappedCoreException(e); @@ -311,7 +311,7 @@ int getInTypeOccurrenceCountForBinaryAnonymousType(TypeDeclaration typeDeclarati public boolean visit(TypeDeclaration typeDeclaration, BlockScope unused) { try { char[] simpleName; - if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) { + if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) { simpleName = CharOperation.NO_CHAR; } else { simpleName = typeDeclaration.name; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java index 8387333b1..05f8d172c 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java @@ -24,7 +24,7 @@ public class MethodDeclarationPattern extends MethodPattern { public int extraFlags; public int declaringTypeModifiers; - + public int modifiers; public char[] signature; public char[][] parameterTypes; @@ -32,7 +32,7 @@ public class MethodDeclarationPattern extends MethodPattern { public char[] fusedDeclaringQualifier = null; // TODO: do we need this; cleanup? /** * Method Declaration entries are encoded as described - * + * * Binary Method Declaration for class * MethodName '/' Arity '/' DeclaringQualifier '/' TypeName '/' TypeModifers '/' PackageName '/' Signature '/' ParameterNamesopt '/' Modifiers '/' returnType * Source method for class @@ -55,13 +55,13 @@ public class MethodDeclarationPattern extends MethodPattern { char[] packageName, int typeModifiers, int extraFlags) { - + char[] countChars; char[] parameterTypesChars = null; char[] parameterNamesChars = null; - - - countChars = argCount < 10 ? new char[] {COUNTS[argCount][1]}: String.valueOf(argCount).toCharArray(); + + + countChars = argCount < 10 ? new char[] {COUNTS[argCount][1]}: String.valueOf(argCount).toCharArray(); if (argCount > 0) { if (signature == null) { if (parameterTypes != null && parameterTypes.length == argCount) { @@ -74,20 +74,20 @@ public class MethodDeclarationPattern extends MethodPattern { parameterNamesChars = CharOperation.concatWith(parameterNames, PARAMETER_SEPARATOR); } } - - char[] returnTypeChars = returnType == null ? CharOperation.NO_CHAR : getTypeErasure(returnType); + + char[] returnTypeChars = returnType == null ? CharOperation.NO_CHAR : getTypeErasure(returnType); int typeModifiersWithExtraFlags = typeModifiers | encodeExtraFlags(extraFlags); int entryIndex = 0; int numEntries = 10; char [][] tmp = new char[numEntries][]; - + tmp[entryIndex++] = methodName != null ? methodName : CharOperation.NO_CHAR; tmp[entryIndex++] = countChars; tmp[entryIndex++] = declaringQualification != null ? declaringQualification : CharOperation.NO_CHAR; tmp[entryIndex++] = typeName != null ? typeName : CharOperation.NO_CHAR; tmp[entryIndex++] = new char[] {(char) typeModifiersWithExtraFlags, (char) (typeModifiersWithExtraFlags>>16)}; tmp[entryIndex++] = packageName != null ? packageName : CharOperation.NO_CHAR; - + if (argCount == 0) { tmp[entryIndex++] = CharOperation.NO_CHAR; tmp[entryIndex++] = CharOperation.NO_CHAR; @@ -99,36 +99,36 @@ public class MethodDeclarationPattern extends MethodPattern { tmp[entryIndex] = returnTypeChars; return CharOperation.concatWithAll(tmp, '/'); } - + private static int encodeExtraFlags(int extraFlags) { int encodedExtraFlags = 0; - + if ((extraFlags & ExtraFlags.ParameterTypesStoredAsSignature) != 0) { encodedExtraFlags |= ASTNode.Bit28; } - + if ((extraFlags & ExtraFlags.IsLocalType) != 0) { encodedExtraFlags |= ASTNode.Bit29; } - + if ((extraFlags & ExtraFlags.IsMemberType) != 0) { encodedExtraFlags |= ASTNode.Bit30; } if ((extraFlags & ExtraFlags.HasNonPrivateStaticMemberTypes) != 0) { encodedExtraFlags |= ASTNode.Bit31; } - + return encodedExtraFlags; } private static char[] getTypeErasure(char[] typeName) { int index; if ((index = CharOperation.indexOf('<', typeName)) == -1) return typeName; - + int length = typeName.length; char[] typeErasurename = new char[length - 2]; - + System.arraycopy(typeName, 0, typeErasurename, 0, index); - + int depth = 1; for (int i = index + 1; i < length; i++) { switch (typeName[i]) { @@ -145,29 +145,29 @@ public class MethodDeclarationPattern extends MethodPattern { break; } } - + System.arraycopy(typeErasurename, 0, typeErasurename = new char[index], 0, index); return typeErasurename; } public MethodDeclarationPattern( - char[] declaringPackageName, - char[] declaringQualification, + char[] declaringPackageName, + char[] declaringQualification, char[] declaringSimpleName, char[] methodName, int matchRule) { - super(methodName, declaringQualification, declaringSimpleName, - null, null, null, null, null, + super(methodName, declaringQualification, declaringSimpleName, + null, null, null, null, null, IJavaSearchConstants.DECLARATIONS, matchRule); this.declaringPackageName = declaringPackageName; } public MethodDeclarationPattern( - char[] declaringQualifier, + char[] declaringQualifier, char[] methodName, int matchRule) { - super(methodName, CharOperation.NO_CHAR, CharOperation.NO_CHAR, - null, null, null, null, null, + super(methodName, CharOperation.NO_CHAR, CharOperation.NO_CHAR, + null, null, null, null, null, IJavaSearchConstants.DECLARATIONS, matchRule); this.fusedDeclaringQualifier = declaringQualifier; } @@ -178,7 +178,7 @@ public MethodDeclarationPattern(int matchRule) { @Override public void decodeIndexKey(char[] key) { - + int start = 0; int slash = CharOperation.indexOf(SEPARATOR, key, start); this.selector = CharOperation.subarray(key, start, slash); @@ -186,7 +186,7 @@ public void decodeIndexKey(char[] key) { start = slash + 1; slash = CharOperation.indexOf(SEPARATOR, key, start); int last = slash - 1; - + this.parameterCount = 0; int power = 1; for (int i = last; i >= start; i--) { @@ -201,29 +201,29 @@ public void decodeIndexKey(char[] key) { start = slash + 1; slash = CharOperation.indexOf(SEPARATOR, key, start); this.declaringQualification = CharOperation.subarray(key, start, slash); - + start = slash + 1; slash = CharOperation.indexOf(SEPARATOR, key, start); this.declaringSimpleName = CharOperation.subarray(key, start, slash); - + start = slash + 1; slash = CharOperation.indexOf(SEPARATOR, key, start); last = slash - 1; int typeModifiersWithExtraFlags = key[last-1] + (key[last]<<16); this.declaringTypeModifiers = ConstructorPattern.decodeModifers(typeModifiersWithExtraFlags); this.extraFlags = ConstructorPattern.decodeExtraFlags(typeModifiersWithExtraFlags); - + // initialize optional fields this.declaringPackageName = null; this.modifiers = 0; this.signature = null; this.parameterTypes = null; this.parameterNames = null; - + start = slash + 1; slash = CharOperation.indexOf(SEPARATOR, key, start); this.declaringPackageName = CharOperation.subarray(key, start, slash); - + start = slash + 1; slash = CharOperation.indexOf(SEPARATOR, key, start); if (this.parameterCount == 0) { @@ -245,15 +245,15 @@ public void decodeIndexKey(char[] key) { } start = slash + 1; slash = CharOperation.indexOf(SEPARATOR, key, start); - + if (slash != start) { this.parameterNames = CharOperation.splitOn(PARAMETER_SEPARATOR, key, start, slash); } - + start = slash + 1; slash = CharOperation.indexOf(SEPARATOR, key, start); last = slash - 1; - + this.modifiers = key[last-1] + (key[last]<<16); } else { this.modifiers = ClassFileConstants.AccPublic; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java index 86e499da8..06ea73868 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java @@ -13,7 +13,7 @@ * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation * Samrat Dhillon samrat.dhillon@gmail.com - Search for method references is - * returning methods as overriden even if the superclass's method is + * returning methods as overriden even if the superclass's method is * only package-visible - https://bugs.eclipse.org/357547 *******************************************************************************/ package org.eclipse.jdt.internal.core.search.matching; @@ -68,15 +68,15 @@ import org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transfor * <dl> * <dt>What:<dd> Consider private role methods as virtual, too. * <dt>Why:<dd> Implicit inheritance causes dynamic dispatch for private methods. - * + * * <dt>What:<dd> retrench callin method signatures. - * + * * <dt>What:<dd> add matching for MethodSpec and tsuper calls. - * + * * <dt>What:<dd> beautify type name with <code>sourceName()</code> - * + * * <dt>What:<dd> resilience if encountering a <code>ProblemMethodBinding</code> - * + * * <dt>What:<dd> for role methods use <code>copyInheritanceSrc</code> for precise information. * </dl> */ @@ -91,7 +91,7 @@ public char[][][] allSuperDeclaringTypeNames; // This is set only if focus is null. In these cases // it will be hard to determine if the super class is of the same package -// at a latter point. Hence, this array is created with all the super class +// at a latter point. Hence, this array is created with all the super class // names of the same package name as of the matching class name. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=357547 private char[][][] samePkgSuperDeclaringTypeNames; @@ -166,7 +166,7 @@ public void initializePolymorphicSearch(MatchLocator locator) { start = System.currentTimeMillis(); } try { - SuperTypeNamesCollector namesCollector = + SuperTypeNamesCollector namesCollector = new SuperTypeNamesCollector( this.pattern, this.pattern.declaringSimpleName, @@ -176,7 +176,7 @@ public void initializePolymorphicSearch(MatchLocator locator) { locator.progressMonitor); this.allSuperDeclaringTypeNames = namesCollector.collect(); this.samePkgSuperDeclaringTypeNames = namesCollector.getSamePackageSuperTypeNames(); - this.matchLocator = locator; + this.matchLocator = locator; } catch (JavaModelException e) { // inaccurate matches will be found } @@ -202,26 +202,26 @@ private boolean isTypeInSuperDeclaringTypeNames(char[][] typeName) { * this message send or not. * {ObjectTeams: * Also private methods in roles invoked via 'this' are virtual message sends in a sense. - * SH} + * SH} */ protected boolean isVirtualInvoke(MethodBinding method, MessageSend messageSend) { - return !method.isStatic() && + return !method.isStatic() && //{ObjectTeams: private role methods are visible in the implicit sub roles (OTJLD 1.2.1. (e)) ( // orig: !method.isPrivate() -// :giro +// :giro || (method.declaringClass.isRole() && messageSend.receiver.isImplicitThis())) && !(messageSend instanceof TSuperMessageSend) // similar to "super" but for codegen it's a "this" //jsv} && !messageSend.isSuperAccess() - && !(method.isDefault() && this.pattern.focus != null + && !(method.isDefault() && this.pattern.focus != null && !CharOperation.equals(this.pattern.declaringPackageName, method.declaringClass.qualifiedPackageName())); } protected ReferenceBinding checkMethodRef(MethodBinding method, ReferenceExpression referenceExpression) { boolean result = (!method.isStatic() && !method.isPrivate() - && referenceExpression.isMethodReference() - && !(method.isDefault() && this.pattern.focus != null + && referenceExpression.isMethodReference() + && !(method.isDefault() && this.pattern.focus != null && !CharOperation.equals(this.pattern.declaringPackageName, method.declaringClass.qualifiedPackageName()))); if (result) { Expression lhs = referenceExpression.lhs; @@ -231,7 +231,7 @@ protected ReferenceBinding checkMethodRef(MethodBinding method, ReferenceExpress return (ReferenceBinding) binding; } } - + return null; } @Override @@ -283,7 +283,7 @@ public int match(MethodDeclaration node, MatchingNodeSet nodeSet) { ASTNode[] args = node.arguments; :giro */ ASTNode[] args = MethodSignatureEnhancer.getSourceArguments(node); -// SH} +// SH} int argsLength = args == null ? 0 : args.length; if (length != argsLength) return IMPOSSIBLE_MATCH; for (int i = 0; i < argsLength; i++) { @@ -324,14 +324,14 @@ public int match(MemberValuePair node, MatchingNodeSet nodeSet) { // public int match(CalloutMappingDeclaration node, MatchingNodeSet nodeSet) - SKIP IT // public int match(CallinMappingDeclaration node, MatchingNodeSet nodeSet) - SKIP IT @Override -public int match(MethodSpec methodSpec, MatchingNodeSet nodeSet) +public int match(MethodSpec methodSpec, MatchingNodeSet nodeSet) { if (!matchesName(this.pattern.selector, methodSpec.selector)) return IMPOSSIBLE_MATCH; - + // a signature-less methodSpec is a possible match -- parameters won't match in any case if (!methodSpec.hasSignature) return nodeSet.addMatch(methodSpec, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); - + if (this.pattern.parameterSimpleNames != null) { int length = this.pattern.parameterSimpleNames.length; @@ -346,11 +346,11 @@ public int match(MethodSpec methodSpec, MatchingNodeSet nodeSet) { if (!matchesTypeReference(this.pattern.parameterSimpleNames[i], args[i].type)) { - return IMPOSSIBLE_MATCH; + return IMPOSSIBLE_MATCH; } } } - + return nodeSet.addMatch(methodSpec, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); } @Override @@ -453,12 +453,12 @@ protected int matchMethod(MethodBinding method, boolean skipImpossibleArg) { // global verification if (method.parameters == null) return INACCURATE_MATCH; //{ObjectTeams: for callin methods use retrenched parameters -/* orig: +/* orig: if (parameterCount != method.parameters.length) return IMPOSSIBLE_MATCH; :giro */ if (parameterCount != method.getSourceParamLength()) return IMPOSSIBLE_MATCH; - TypeBinding[] methodParamters = method.getSourceParameters(); -// SH} + TypeBinding[] methodParamters = method.getSourceParameters(); +// SH} if (!method.isValidBinding() && ((ProblemMethodBinding)method).problemId() == ProblemReasons.Ambiguous) { // return inaccurate match for ambiguous call (bug 80890) return INACCURATE_MATCH; @@ -470,9 +470,9 @@ protected int matchMethod(MethodBinding method, boolean skipImpossibleArg) { // verify each parameter for (int i = 0; i < parameterCount; i++) { //{ObjectTeams: callin method? -/* orig: +/* orig: TypeBinding argType = method.parameters[i]; - :giro */ + :giro */ TypeBinding argType = methodParamters[i]; // SH} int newLevel = IMPOSSIBLE_MATCH; @@ -485,7 +485,7 @@ protected int matchMethod(MethodBinding method, boolean skipImpossibleArg) { if (focusMethodBinding != null) {// textual comparison insufficient TypeBinding[] parameters = focusMethodBinding.parameters; if (parameters.length >= parameterCount) { - newLevel = (isBinary ? argType.erasure().isEquivalentTo((parameters[i].erasure())) :argType.isEquivalentTo((parameters[i]))) ? + newLevel = (isBinary ? argType.erasure().isEquivalentTo((parameters[i].erasure())) :argType.isEquivalentTo((parameters[i]))) ? ACCURATE_MATCH : IMPOSSIBLE_MATCH; foundLevel = true; } @@ -515,7 +515,7 @@ protected int matchMethod(MethodBinding method, boolean skipImpossibleArg) { } if (foundTypeVariable) { if (!method.isStatic() && !method.isPrivate()) { - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=123836, No point in textually comparing type variables, captures etc with concrete types. + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=123836, No point in textually comparing type variables, captures etc with concrete types. if (!checkedFocus) focusMethodBinding = this.matchLocator.getMethodBinding(this.pattern); if (focusMethodBinding != null) { @@ -523,7 +523,7 @@ protected int matchMethod(MethodBinding method, boolean skipImpossibleArg) { return ACCURATE_MATCH; } } - } + } return IMPOSSIBLE_MATCH; } } @@ -621,26 +621,26 @@ protected void matchReportReference(ASTNode reference, IJavaElement element, IJa //{ObjectTeams: use method sourceName() instead of field sourceName: /* orig: if (isPrivate && !CharOperation.equals(methodBinding.declaringClass.sourceName, focus.getParent().getElementName().toCharArray())) { - :giro */ + :giro */ ReferenceBinding mDeclaringClass = methodBinding.declaringClass; // for anon classes sourceName() is not usable here: - char[] declaringClassName = mDeclaringClass.isAnonymousType() ? mDeclaringClass.sourceName : mDeclaringClass.sourceName(); + char[] declaringClassName = mDeclaringClass.isAnonymousType() ? mDeclaringClass.sourceName : mDeclaringClass.sourceName(); if (isPrivate && !CharOperation.equals(declaringClassName, focus.getParent().getElementName().toCharArray())) { -// SH} +// SH} return; // finally the match was not possible } } } matchReportReference((MessageSend)reference, locator, accuracy, ((MessageSend)reference).binding); //ObjectTeams: calculate source range for selection of method spec (method reference) - } else if (this.pattern.findReferences && reference instanceof MethodSpec) + } else if (this.pattern.findReferences && reference instanceof MethodSpec) { MethodSpec methodSpec= (MethodSpec)reference; int offset = methodSpec.sourceStart ; - SearchMatch newMatch = locator.newMethodReferenceMatch(element, elementBinding, accuracy, offset, + SearchMatch newMatch = locator.newMethodReferenceMatch(element, elementBinding, accuracy, offset, methodSpec.declarationSourceEnd - offset + 1, false/*not constructor*/, false/*not synthetic*/, reference); locator.report(newMatch); -//jsv} +//jsv} } else { if (reference instanceof SingleMemberAnnotation) { reference = ((SingleMemberAnnotation)reference).memberValuePairs()[0]; @@ -755,7 +755,7 @@ private boolean methodParametersEqualsPattern(MethodBinding method) { TypeBinding[] methodParameters = method.parameters; :giro */ TypeBinding[] methodParameters = method.getSourceParameters(); -// SH} +// SH} int length = methodParameters.length; if (length != this.pattern.parameterSimpleNames.length) return false; @@ -816,11 +816,11 @@ protected void reportDeclaration(MethodBinding methodBinding, MatchLocator locat if (type.isBinary()) { IMethod method = null; //{ObjectTeams: for callin methods use the retrenched parameters: -/* orig: +/* orig: TypeBinding[] parameters = methodBinding.original().parameters; :giro */ TypeBinding[] parameters = methodBinding.original().getSourceParameters(); -// SH} +// SH} int parameterLength = parameters.length; char[][] parameterTypes = new char[parameterLength][]; for (int i = 0; i<parameterLength; i++) { @@ -832,7 +832,7 @@ protected void reportDeclaration(MethodBinding methodBinding, MatchLocator locat } method = locator.createBinaryMethodHandle(type, methodBinding.selector, parameterTypes); if (method == null || knownMethods.addIfNotIncluded(method) == null) return; - + IResource resource = type.getResource(); if (resource == null) resource = type.getJavaProject().getProject(); @@ -930,7 +930,7 @@ public int resolveLevel(Binding binding) { // used. Otherwise an exact match will not be found, because the // parameter count of the search pattern will differ from the // parameter count in the method binding (see also method -// matchMethod(MethodBinding) in this class). +// matchMethod(MethodBinding) in this class). if (method.parameters != null) { TypeBinding[] paramTypes = method.parameters; @@ -949,7 +949,7 @@ public int resolveLevel(Binding binding) { } } } -//gbr} +//gbr} boolean skipVerif = this.pattern.findDeclarations && this.mayBeGeneric; int methodLevel = matchMethod(method, skipVerif); if (methodLevel == IMPOSSIBLE_MATCH) { @@ -1094,7 +1094,7 @@ protected int resolveLevelAsSubtype(char[] simplePattern, char[] qualifiedPatter if (type == null) return INACCURATE_MATCH; int level = resolveLevelForType(simplePattern, qualifiedPattern, type); -//{ObjectTeams: perform deferred checking of tsub/tsuper: +//{ObjectTeams: perform deferred checking of tsub/tsuper: if (level != IMPOSSIBLE_MATCH) { char[] typeName= type.getRealType().readableName(); level= this.pattern.resolveLevelForType(new String(typeName), level); @@ -1134,19 +1134,19 @@ protected int resolveLevelAsSubtype(char[] simplePattern, char[] qualifiedPatter } //{ObjectTeams: matches implicit supertypes: - RoleModel roleModel = type.roleModel; + RoleModel roleModel = type.roleModel; if (type.roleModel != null) { ReferenceBinding[] tsuperTypes = roleModel.getTSuperRoleBindings(); for (int t = tsuperTypes.length-1; t>=0; t--) { // check highest prio first (which comes last in the array) level = resolveLevelAsSubtype(simplePattern, qualifiedPattern, tsuperTypes[t], methodName, argumentTypes, packageName, isDefault); - // OT_COPY_PASTE from above "matches superclass": + // OT_COPY_PASTE from above "matches superclass": if (level != IMPOSSIBLE_MATCH) { if (argumentTypes != null) { // need to verify if method may be overridden MethodBinding[] methods = type.getMethods(this.pattern.selector); for (int i=0, length=methods.length; i<length; i++) { MethodBinding method = methods[i]; - //{OT: if method is copied don't consider it as overriding: + //{OT: if method is copied don't consider it as overriding: if (method.copyInheritanceSrc != null) continue; // SH} @@ -1177,8 +1177,8 @@ protected int resolveLevelAsSubtype(char[] simplePattern, char[] qualifiedPatter // } } -// SH} - +// SH} + // matches interfaces ReferenceBinding[] interfaces = type.superInterfaces(); if (interfaces == null) return INACCURATE_MATCH; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java index 3ca298f06..abe284202 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java @@ -100,12 +100,12 @@ MethodPattern(int matchRule) { super(METHOD_PATTERN, matchRule); } public MethodPattern( - char[] selector, + char[] selector, char[] declaringQualification, - char[] declaringSimpleName, - char[] returnQualification, + char[] declaringSimpleName, + char[] returnQualification, char[] returnSimpleName, - char[][] parameterQualifications, + char[][] parameterQualifications, char[][] parameterSimpleNames, IType declaringType, int limitTo, @@ -155,30 +155,30 @@ public MethodPattern( * Instanciate a method pattern with signatures for generics search */ public MethodPattern( - char[] selector, + char[] selector, char[] declaringQualification, - char[] declaringSimpleName, - char[] returnQualification, + char[] declaringSimpleName, + char[] returnQualification, char[] returnSimpleName, String returnSignature, - char[][] parameterQualifications, + char[][] parameterQualifications, char[][] parameterSimpleNames, String[] parameterSignatures, IMethod method, int limitTo, int matchRule) { - this(selector, + this(selector, declaringQualification, - declaringSimpleName, - returnQualification, + declaringSimpleName, + returnQualification, returnSimpleName, - parameterQualifications, + parameterQualifications, parameterSimpleNames, method.getDeclaringType(), limitTo, matchRule); - + // Set flags try { this.varargs = (method.getFlags() & Flags.AccVarargs) != 0; @@ -226,35 +226,35 @@ public MethodPattern( this.methodArguments = extractMethodArguments(method); if (hasMethodArguments()) this.mustResolve = true; //{ObjectTeams: constrain the direction of this pattern? - if (findingCallers.get() != null) + if (findingCallers.get() != null) this.constrainToCallerDirection = true; //SH} - + } /* * Instanciate a method pattern with signatures for generics search */ public MethodPattern( - char[] selector, + char[] selector, char[] declaringQualification, - char[] declaringSimpleName, + char[] declaringSimpleName, String declaringSignature, - char[] returnQualification, + char[] returnQualification, char[] returnSimpleName, String returnSignature, - char[][] parameterQualifications, + char[][] parameterQualifications, char[][] parameterSimpleNames, String[] parameterSignatures, char[][] arguments, int limitTo, int matchRule) { - this(selector, + this(selector, declaringQualification, - declaringSimpleName, - returnQualification, + declaringSimpleName, + returnQualification, returnSimpleName, - parameterQualifications, + parameterQualifications, parameterSimpleNames, null, limitTo, @@ -333,15 +333,15 @@ public boolean isPolymorphicSearch() { public boolean matchesDecodedKey(SearchPattern decodedPattern) { MethodPattern pattern = (MethodPattern) decodedPattern; - return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 -//{ObjectTeams: return true even if paramCount = Integer.MAX_VALUE + return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 +//{ObjectTeams: return true even if paramCount = Integer.MAX_VALUE || pattern.parameterCount == Integer.MAX_VALUE -//jsv} +//jsv} || this.varargs) && matchesName(this.selector, pattern.selector); } /** - * Returns whether a method declaration or message send must be resolved to + * Returns whether a method declaration or message send must be resolved to * find out if this method pattern matches it. */ protected boolean mustResolve() { @@ -365,7 +365,7 @@ public EntryResult[] queryIn(Index index) throws IOException { //{ObjectTeams: we may need a second key to query methodspecs without signature (param count unknown) char[] key2 = null; //jsv} - + int matchRule = getMatchRule(); switch(getMatchMode()) { @@ -393,7 +393,7 @@ public EntryResult[] queryIn(Index index) throws IOException { //{ObjectTeam: generate second key key2 = createIndexKey(this.selector == null ? ONE_STAR : this.selector, Integer.MAX_VALUE); //jsv} - } + } else if (this.selector != null && this.selector[this.selector.length - 1] != '*') key = CharOperation.concat(this.selector, ONE_STAR, SEPARATOR); // else do a pattern query with just the selector @@ -409,18 +409,18 @@ public EntryResult[] queryIn(Index index) throws IOException { //{ObjectTeams: combine results for both queries EntryResult[] key1Result = index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null EntryResult[] key2Result = key2 == null ? null : index.query(getIndexCategories(), key2, matchRule); - + // no merging if one or both are null: if (key1Result == null) return key2Result; if (key2Result == null) return key1Result; // beyond this point: both results are non-null, merge them: - + EntryResult[] result = new EntryResult[key1Result.length + key2Result.length]; System.arraycopy(key1Result, 0,result, 0, key1Result.length); System.arraycopy(key2Result, 0, result, key1Result.length, key2Result.length); - + return result; // orig // return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null @@ -481,7 +481,7 @@ public void setDeclaringRoleClass(IType declaringClass) { public int resolveLevelForType(String typeName, int declaringLevel) { if (this.declaringRoleClass == null || typeName.equals(this.declaringRoleClass.getFullyQualifiedName('.'))) return declaringLevel; - + if (this.cachedRoleHierarchy != null) { IType superType = this.cachedRoleHierarchy.getSuperclass(this.declaringRoleClass); // OTTypeHierarchies will ensure that tsupers are traversed, too. while (superType != null && OTModelManager.isRole(superType)) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ModuleLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ModuleLocator.java index 3e20b13cc..3e4388da4 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ModuleLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ModuleLocator.java @@ -18,10 +18,10 @@ import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding; * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation - * + * *******************************************************************************/ public class ModuleLocator extends PatternLocator { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java index fffa82620..0a8e246dd 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java @@ -24,7 +24,7 @@ public class MultiTypeDeclarationPattern extends JavaSearchPattern { public char[][] simpleNames; public char[][] qualifications; -// set to CLASS_SUFFIX for only matching classes +// set to CLASS_SUFFIX for only matching classes // set to INTERFACE_SUFFIX for only matching interfaces // set to ENUM_SUFFIX for only matching enums // set to ANNOTATION_TYPE_SUFFIX for only matching annotation types @@ -78,7 +78,7 @@ public char[][] getIndexCategories() { @Override public boolean matchesDecodedKey(SearchPattern decodedPattern) { QualifiedTypeDeclarationPattern pattern = (QualifiedTypeDeclarationPattern) decodedPattern; - + // check type suffix if (this.typeSuffix != pattern.typeSuffix && this.typeSuffix != TYPE_SUFFIX) { if (!matchDifferentTypeSuffixes(this.typeSuffix, pattern.typeSuffix)) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrLocator.java index e4cf898c8..065ce69cd 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrLocator.java @@ -188,7 +188,7 @@ public int match(CalloutMappingDeclaration node, MatchingNodeSet nodeSet) { return ACCURATE_MATCH; } - level = newLevel; + level = newLevel; } } return level; @@ -227,7 +227,7 @@ public int match(ParameterMapping node, MatchingNodeSet nodeSet) level = newLevel; } } - return level; + return level; } @Override public int match(MethodSpec node, MatchingNodeSet nodeSet) diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java index e7ca15558..9bec6f4d2 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java @@ -34,13 +34,13 @@ public class OrPattern extends SearchPattern implements IIndexConstants { super(Math.max(leftPattern.getMatchRule(), rightPattern.getMatchRule())); 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; int leftSize = leftPatterns == null ? 1 : leftPatterns.length; int rightSize = rightPatterns == null ? 1 : rightPatterns.length; this.patterns = new SearchPattern[leftSize + rightSize]; - + if (leftPatterns == null) this.patterns[0] = leftPattern; else @@ -86,7 +86,7 @@ public class OrPattern extends SearchPattern implements IIndexConstants { /** * Returns whether the pattern has one or several package declaration or not. - * + * * @return <code>true</code> if one at least of the stored pattern is a package declaration * pattern ({@link PackageDeclarationPattern}), <code>false</code> otherwise. */ diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java index f5fa34485..64d495d80 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java @@ -31,7 +31,7 @@ public EntryResult[] queryIn(Index index) { @Override protected StringBuffer print(StringBuffer output) { output.append("PackageDeclarationPattern: <"); //$NON-NLS-1$ - if (this.pkgName != null) + if (this.pkgName != null) output.append(this.pkgName); else output.append("*"); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java index 543facd42..64f146e61 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java @@ -37,8 +37,8 @@ public static boolean isDeclaringPackageFragment(IPackageFragment packageFragmen // retrieve the actual file name from the full path (sources are generally only containing it already) fileName = CharOperation.replaceOnCopy(fileName, '/', '\\'); // ensure to not do any side effect on file name (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=136016) fileName = CharOperation.lastSegment(fileName, '\\'); - - try { + + try { switch (packageFragment.getKind()) { case IPackageFragmentRoot.K_SOURCE : if (!org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(fileName) || !packageFragment.getCompilationUnit(new String(fileName)).exists()) { @@ -60,7 +60,7 @@ public static boolean isDeclaringPackageFragment(IPackageFragment packageFragmen // unable to determine kind; tolerate this match } } - return true; // by default, do not eliminate + return true; // by default, do not eliminate } public PackageReferenceLocator(PackageReferencePattern pattern) { @@ -220,7 +220,7 @@ protected void matchReportReference(ASTNode reference, IJavaElement element, IJa break; case Binding.VARIABLE : //============unbound cases=========== case Binding.TYPE | Binding.VARIABLE : - Binding binding = qNameRef.binding; + Binding binding = qNameRef.binding; if (binding instanceof TypeBinding) { typeBinding = (TypeBinding) binding; } else if (binding instanceof ProblemFieldBinding) { @@ -231,7 +231,7 @@ protected void matchReportReference(ASTNode reference, IJavaElement element, IJa typeBinding = pbBinding.searchType; last = CharOperation.occurencesOf('.', pbBinding.name); } - break; + break; } } else if (reference instanceof QualifiedTypeReference) { QualifiedTypeReference qTypeRef = (QualifiedTypeReference) reference; @@ -329,7 +329,7 @@ public int resolveLevel(Binding binding) { // check that type is located inside this instance of a package fragment if (!isDeclaringPackageFragment((IPackageFragment) this.pattern.focus, (ReferenceBinding)binding)) return IMPOSSIBLE_MATCH; - } + } return ACCURATE_MATCH; } return IMPOSSIBLE_MATCH; @@ -354,7 +354,7 @@ protected int resolveLevel(QualifiedNameReference qNameRef) { */ case Binding.VARIABLE : //============unbound cases=========== case Binding.TYPE | Binding.VARIABLE : - Binding binding = qNameRef.binding; + Binding binding = qNameRef.binding; if (binding instanceof ProblemReferenceBinding) { typeBinding = (TypeBinding) binding; } else if (binding instanceof ProblemFieldBinding) { @@ -367,7 +367,7 @@ protected int resolveLevel(QualifiedNameReference qNameRef) { return INACCURATE_MATCH; typeBinding = pbBinding.searchType; } - break; + break; } return resolveLevel(typeBinding); } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java index 68bd4bf6e..bb42f3bf8 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java @@ -53,7 +53,7 @@ public SearchPattern getBlankPattern() { @Override public char[] getIndexKey() { // Package reference keys are encoded as 'name' (where 'name' is the last segment of the package name) - if (this.currentSegment >= 0) + if (this.currentSegment >= 0) return this.segments[this.currentSegment]; return null; } @@ -79,7 +79,7 @@ protected void resetQuery() { @Override protected StringBuffer print(StringBuffer output) { output.append("PackageReferencePattern: <"); //$NON-NLS-1$ - if (this.pkgName != null) + if (this.pkgName != null) output.append(this.pkgName); else output.append("*"); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java index 099d4d34e..46a132276 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java @@ -83,16 +83,16 @@ public static final int CLASS_CONTAINER = 2; public static final int METHOD_CONTAINER = 4; public static final int FIELD_CONTAINER = 8; //ObjectTeams: to increase the search performance we need an own match container for method mappings -// - contains method specs and parameter mappings -//TODO(jsv): do we need a separate container for methodSpecs and parameter mappings? +// - contains method specs and parameter mappings +//TODO(jsv): do we need a separate container for methodSpecs and parameter mappings? public static final int METHOD_MAPPING_CONTAINER = 16; //jsv} public static final int ALL_CONTAINER = COMPILATION_UNIT_CONTAINER | CLASS_CONTAINER | METHOD_CONTAINER | FIELD_CONTAINER //ObjectTeams: add method mapping container to "ALL_CONTAINER" - | METHOD_MAPPING_CONTAINER ; -//jsv} - + | METHOD_MAPPING_CONTAINER ; +//jsv} + /* match rule */ public static final int RAW_MASK = SearchPattern.R_EQUIVALENT_MATCH | SearchPattern.R_ERASURE_MATCH; @@ -129,7 +129,7 @@ public static PatternLocator patternLocator(SearchPattern pattern) { return new TeamDeclarationLocator((TeamTypePattern) pattern); case IIndexConstants.ROLE_DECL_PATTERN : return new RoleDeclarationLocator((RoleTypePattern) pattern); - case IIndexConstants.REF_TO_TEAMPACKAGE_PATTERN : + case IIndexConstants.REF_TO_TEAMPACKAGE_PATTERN : return new ReferenceToTeamLocator((ReferenceToTeamPackagePattern) pattern); //carp} case IIndexConstants.MODULE_PATTERN: @@ -214,7 +214,7 @@ protected TypeBinding getTypeNameBinding(int index) { } /** * Initializes this search pattern so that polymorphic search can be performed. - */ + */ public void initializePolymorphicSearch(MatchLocator locator) { // default is to do nothing } @@ -271,7 +271,7 @@ public int match(CallinMappingDeclaration callinMappingDeclaration, MatchingNode public int match(ParameterMapping paramMapping, MatchingNodeSet nodeSet) { // each subtype should override if needed - return IMPOSSIBLE_MATCH; + return IMPOSSIBLE_MATCH; } public int match(MethodSpec methodSpec, MatchingNodeSet nodeSet) { @@ -344,7 +344,7 @@ protected boolean matchesName(char[] pattern, char[] name) { /** * Return how the given name matches the given pattern. * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=79866" - * + * * @param pattern * @param name * @return Possible values are: @@ -459,9 +459,9 @@ protected void matchLevelAndReportImportRef(ImportReference importRef, Binding b int level = resolveLevel(binding); if (level >= INACCURATE_MATCH) { matchReportImportRef( - importRef, - binding, - locator.createImportHandle(importRef), + importRef, + binding, + locator.createImportHandle(importRef), level == ACCURATE_MATCH ? SearchMatch.A_ACCURATE : SearchMatch.A_INACCURATE, @@ -543,7 +543,7 @@ public int resolveLevel(ASTNode possibleMatchingNode) { * Set the flavors for which the locator has to be focused on. * If not set, the locator will accept all matches with or without flavors. * When set, the locator will only accept match having the corresponding flavors. - * + * * @param flavors Bits mask specifying the flavors to be accepted or * <code>0</code> to ignore the flavors while accepting matches. */ @@ -571,7 +571,7 @@ protected void updateMatch(ParameterizedTypeBinding parameterizedBinding, char[] if (isRaw && !this.match.isRaw()) { this.match.setRaw(isRaw); } - + // Update match if (!endPattern && patternTypeArguments != null) { // verify if this is a reference to the generic type itself @@ -589,7 +589,7 @@ protected void updateMatch(ParameterizedTypeBinding parameterizedBinding, char[] } if (needUpdate) { char[][] patternArguments = patternTypeArguments[depth]; - updateMatch(argumentsBindings, locator, patternArguments, patternHasTypeParameters); + updateMatch(argumentsBindings, locator, patternArguments, patternHasTypeParameters); } } else { char[][] patternArguments = patternTypeArguments[depth]; @@ -626,7 +626,7 @@ protected void updateMatch(TypeBinding[] argumentsBinding, MatchLocator locator, if (hasTypeParameters) { matchRule = SearchPattern.R_ERASURE_MATCH; } - + // Compare arguments lengthes if (patternTypeArgsLength == typeArgumentsLength) { if (!this.match.isRaw() && hasTypeParameters) { @@ -687,7 +687,7 @@ protected void updateMatch(TypeBinding[] argumentsBinding, MatchLocator locator, } patternTypeName = Signature.toCharArray(patternTypeName); TypeBinding patternBinding = locator.getType(patternTypeArgument, patternTypeName); - + // If have no binding for pattern arg, then we won't be able to refine accuracy if (patternBinding == null) { if (argumentBinding.isWildcard()) { @@ -731,7 +731,7 @@ protected void updateMatch(TypeBinding[] argumentsBinding, MatchLocator locator, continue; } } else if (argumentBinding.isCompatibleWith(patternBinding)) { - // valid when arg is a subclass of pattern + // valid when arg is a subclass of pattern matchRule &= ~SearchPattern.R_FULL_MATCH; continue; } @@ -791,7 +791,7 @@ protected void updateMatch(TypeBinding[] argumentsBinding, MatchLocator locator, continue; break; } - + // Argument does not match => erasure match will be the only possible one this.match.setRule(SearchPattern.R_ERASURE_MATCH); return; @@ -813,7 +813,7 @@ public int resolveLevel(Binding binding) { return INACCURATE_MATCH; } /** - * Returns whether the given type binding matches the given simple name pattern + * Returns whether the given type binding matches the given simple name pattern * and qualification pattern. * Note that from since 3.1, this method resolve to accurate member or local types * even if they are not fully qualified (i.e. X.Member instead of p.X.Member). @@ -887,7 +887,7 @@ protected int resolveLevelForType(char[] qualifiedPattern, TypeBinding type) { IntersectionTypeBinding18 i18 = (IntersectionTypeBinding18) type; for (ReferenceBinding ref : i18.intersectingTypes) { result = resolveLevelForType(qualifiedPattern, ref); - if (result == ACCURATE_MATCH) return result; + if (result == ACCURATE_MATCH) return result; if (result == IMPOSSIBLE_MATCH) continue; if (prev == IMPOSSIBLE_MATCH) prev = result; } @@ -918,7 +918,7 @@ protected int resolveLevelForType (char[] simpleNamePattern, if (type == null || patternTypeArguments == null || patternTypeArguments.length == 0 || depth >= patternTypeArguments.length) { return level; } - + // if pattern is erasure match (see bug 79790), commute impossible to erasure int impossible = this.isErasureMatch ? ERASURE_MATCH : IMPOSSIBLE_MATCH; @@ -945,7 +945,7 @@ protected int resolveLevelForType (char[] simpleNamePattern, // raw type always match if (type.isRawType()) { return level; - } + } // Standard types (i.e. neither generic nor parameterized nor raw types) // cannot match pattern with type parameters or arguments @@ -1015,7 +1015,7 @@ protected int resolveLevelForType (char[] simpleNamePattern, // If pattern is not exact then match fails if (patternTypeArgHasAnyChars) return impossible; - + // Look for bound name in type argument superclasses boundBinding = boundBinding.superclass(); while (boundBinding != null) { @@ -1032,7 +1032,7 @@ protected int resolveLevelForType (char[] simpleNamePattern, } return impossible; } - + // See if names match if (CharOperation.match(patternTypeArgument, argTypeBinding.shortReadableName(), this.isCaseSensitive) || CharOperation.match(patternTypeArgument, argTypeBinding.readableName(), this.isCaseSensitive)) { @@ -1065,7 +1065,7 @@ protected int resolveLevelForType (char[] simpleNamePattern, return impossible; } } - + // Recurse on enclosing type TypeBinding enclosingType = paramTypeBinding.enclosingType(); if (enclosingType != null && enclosingType.isParameterizedType() && depth < patternTypeArguments.length && qualificationPattern != null) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PossibleMatch.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PossibleMatch.java index 696c085df..b704eeffc 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PossibleMatch.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PossibleMatch.java @@ -160,7 +160,7 @@ PossibleMatch getSimilarMatch() { private String getSourceFileName() { if (this.sourceFileName != null) return this.sourceFileName; - this.sourceFileName = NO_SOURCE_FILE_NAME; + this.sourceFileName = NO_SOURCE_FILE_NAME; if (this.openable.getSourceMapper() != null) { if (this.openable instanceof ClassFile) { BinaryType type = (BinaryType) ((ClassFile) this.openable).getType(); @@ -175,7 +175,7 @@ private String getSourceFileName() { } } return this.sourceFileName; -} +} boolean hasSimilarMatch() { return this.similarMatch != null && (this.source == NO_SOURCE_FILE || isModuleInfo(this)); } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java index 157f1cbb6..830319467 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java @@ -90,7 +90,7 @@ public SearchPattern getBlankPattern() { @Override public boolean matchesDecodedKey(SearchPattern decodedPattern) { QualifiedTypeDeclarationPattern pattern = (QualifiedTypeDeclarationPattern) decodedPattern; - + // check type suffix if (this.typeSuffix != pattern.typeSuffix && this.typeSuffix != TYPE_SUFFIX) { if (!matchDifferentTypeSuffixes(this.typeSuffix, pattern.typeSuffix)) { @@ -130,7 +130,7 @@ protected StringBuffer print(StringBuffer output) { output.append("TypeDeclarationPattern: qualification<"); //$NON-NLS-1$ break; } - if (this.qualification != null) + if (this.qualification != null) output.append(this.qualification); else output.append("*"); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SecondaryTypeDeclarationPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SecondaryTypeDeclarationPattern.java index fbe539c30..f1e553d5f 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SecondaryTypeDeclarationPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SecondaryTypeDeclarationPattern.java @@ -21,7 +21,7 @@ import org.eclipse.jdt.internal.core.index.Index; import org.eclipse.jdt.internal.core.search.indexing.IIndexConstants; public class SecondaryTypeDeclarationPattern extends TypeDeclarationPattern { - + private final static char[] SECONDARY_PATTERN_KEY = "*/S".toCharArray(); //$NON-NLS-1$ public SecondaryTypeDeclarationPattern() { @@ -46,5 +46,5 @@ protected StringBuffer print(StringBuffer output) { public EntryResult[] queryIn(Index index) throws IOException { return index.query(CATEGORIES, SECONDARY_PATTERN_KEY, R_PATTERN_MATCH | R_CASE_SENSITIVE); } - + } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeNamesCollector.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeNamesCollector.java index 9990d6a26..389e99b04 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeNamesCollector.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeNamesCollector.java @@ -120,7 +120,7 @@ private boolean addIfSamePackage(char[][] compoundName, char[][] path) { int resultLength = this.samePackageSuperTypeName.length; for (int i = 0; i < resultLength; i++) if (CharOperation.equals(this.samePackageSuperTypeName[i], compoundName)) return false; // already known - + for (int i = 0, length = compoundName.length - 1; i < length; i ++) { if (!CharOperation.equals(compoundName[i], path[i])) return false; } @@ -164,11 +164,11 @@ protected CompilationUnitDeclaration buildBindings(ICompilationUnit compilationU // if (unit.scope != null) // unit.scope.faultInTypes(); // fault in fields & methods // unit.resolve(); -// :giro +// :giro Dependencies.ensureState(unit, ITranslationStates.STATE_RESOLVED); } } -// SH} +// SH} } return unit; } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java index 824a5c146..e0609bc5b 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java @@ -65,7 +65,7 @@ public int match(TypeReference node, MatchingNodeSet nodeSet) { } else { // QualifiedTypeReference char[][] tokens = ((QualifiedTypeReference) node).tokens; typeRefSimpleName = tokens[tokens.length-1]; - } + } if (matchesName(this.pattern.superSimpleName, typeRefSimpleName)) return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); @@ -139,7 +139,7 @@ public int resolveLevel(Binding binding) { case SuperTypeReferencePattern.ALL_SUPER_TYPES: case SuperTypeReferencePattern.ONLY_BASE_CLASSES: level = resolveLevelForType(this.pattern.superSimpleName, this.pattern.superQualification, type.baseclass()); - if (level == ACCURATE_MATCH) return ACCURATE_MATCH; + if (level == ACCURATE_MATCH) return ACCURATE_MATCH; } // SH} if (this.pattern.superRefKind != SuperTypeReferencePattern.ONLY_SUPER_INTERFACES) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java index c41517b36..fff8cfdf8 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java @@ -28,10 +28,10 @@ public char[] superQualification; public char[] superSimpleName; public char superClassOrInterface; -// set to CLASS_SUFFIX for only matching classes +// set to CLASS_SUFFIX for only matching classes // set to INTERFACE_SUFFIX for only matching interfaces // set to TYPE_SUFFIX for matching both classes and interfaces -public char typeSuffix; +public char typeSuffix; public char[] pkgName; public char[] simpleName; public char[] enclosingTypeName; @@ -64,7 +64,7 @@ public static char[] createIndexKey( if (Flags.isTeam(modifiers)) superTypeName = TEAM; else -//MW + AK} +//MW + AK} superTypeName = OBJECT; char[] superSimpleName = CharOperation.lastSegment(superTypeName, '.'); char[] superQualification = null; @@ -94,7 +94,7 @@ public static char[] createIndexKey( char[] enclosingTypeName = CharOperation.concatWith(enclosingTypeNames, '$'); if (superQualification != null && CharOperation.equals(superQualification, packageName)) packageName = ONE_ZERO; // save some space - + char[] typeParameters = CharOperation.NO_CHAR; int typeParametersLength = 0; if (typeParameterSignatures != null) { @@ -264,16 +264,16 @@ public char[][] getIndexCategories() { @Override public boolean matchesDecodedKey(SearchPattern decodedPattern) { SuperTypeReferencePattern pattern = (SuperTypeReferencePattern) decodedPattern; - if (this.superRefKind == ONLY_SUPER_CLASSES && pattern.enclosingTypeName != ONE_ZERO/*not an anonymous*/) + if (this.superRefKind == ONLY_SUPER_CLASSES && pattern.enclosingTypeName != ONE_ZERO/*not an anonymous*/) // consider enumerations as classes, reject interfaces and annotations - if (pattern.superClassOrInterface == INTERFACE_SUFFIX - || pattern.superClassOrInterface == ANNOTATION_TYPE_SUFFIX) + if (pattern.superClassOrInterface == INTERFACE_SUFFIX + || pattern.superClassOrInterface == ANNOTATION_TYPE_SUFFIX) return false; //{ObjectTeams: don't mix baseclass and super references if ((this.superRefKind == ONLY_BASE_CLASSES) != (pattern.superClassOrInterface == BASECLASS_SUFFIX)) return false; // SH} - + if (pattern.superQualification != null) if (!matchesName(this.superQualification, pattern.superQualification)) return false; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java index 3e878c2ed..04a4c5c85 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java @@ -115,7 +115,7 @@ public int resolveLevel(Binding binding) { } } /** - * Returns whether the given type binding matches the given simple name pattern + * Returns whether the given type binding matches the given simple name pattern * qualification pattern and enclosing type name pattern. */ protected int resolveLevelForType(char[] simpleNamePattern, char[] qualificationPattern, char[] enclosingNamePattern, TypeBinding type) { @@ -131,7 +131,7 @@ protected int resolveLevelForType(char[] simpleNamePattern, char[] qualification char[] fullQualificationPattern = CharOperation.concat(qualificationPattern, enclosingNamePattern, '.'); if (CharOperation.equals(this.pattern.pkg, CharOperation.concatWith(type.getPackage().compoundName, '.'))) return resolveLevelForType(simpleNamePattern, fullQualificationPattern, type); -//{ObjectTeams: must use compound name of enclosing type (declaring team) in case of role declarations in role files +//{ObjectTeams: must use compound name of enclosing type (declaring team) in case of role declarations in role files if (type instanceof MemberTypeBinding) { MemberTypeBinding roleType = (MemberTypeBinding)type; @@ -174,7 +174,7 @@ private HashSet<String> getModuleGraph(String mName, TypeDeclarationPattern type } } }; - final SearchRequestor requestor = new SearchRequestor() { + final SearchRequestor requestor = new SearchRequestor() { @Override public void acceptSearchMatch(SearchMatch searchMatch) throws CoreException { System.out.println(searchMatch.toString()); @@ -210,13 +210,13 @@ private char[][] getModuleList(TypeDeclarationPattern typePattern) { char[][] tmp = new char[sz][]; for (int i = 0; i < sz; ++i) { tmp[i] = ar[i].toCharArray(); - } + } typePattern.moduleGraphElements = tmp; } return typePattern.moduleGraphElements; } private int matchModule(TypeDeclarationPattern typePattern, TypeBinding type) { - if (!(type instanceof ReferenceBinding)) + if (!(type instanceof ReferenceBinding)) return INACCURATE_MATCH; // a safety net, should not come here for error free code. ReferenceBinding reference = (ReferenceBinding) type; ModuleBinding module = reference.module(); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java index b27fda3da..dff4bdbd9 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java @@ -34,12 +34,12 @@ private boolean allowModuleRegex = false; // enable to try experimental Module R public boolean moduleGraph = false; /* package */ char[][] moduleGraphElements = null; -// set to CLASS_SUFFIX for only matching classes +// set to CLASS_SUFFIX for only matching classes // set to INTERFACE_SUFFIX for only matching interfaces // set to ENUM_SUFFIX for only matching enums // set to ANNOTATION_TYPE_SUFFIX for only matching annotation types // set to TYPE_SUFFIX for matching both classes and interfaces -public char typeSuffix; +public char typeSuffix; public int modifiers; public boolean secondary = false; @@ -186,7 +186,7 @@ protected void addModuleNames(char[] modNames) { final String explicit_unnamed = new String(IJavaSearchConstants.ALL_UNNAMED); String[] names = new String(modNames).split(String.valueOf(CharOperation.COMMA_SEPARATOR)); int len = names.length; - if (this.allowModuleRegex && len > 0 && names[0] != null && names[0].length() > 0 + if (this.allowModuleRegex && len > 0 && names[0] != null && names[0].length() > 0 && names[0].charAt(0) == IIndexConstants.ZERO_CHAR) { //pattern names[0] = names[0].substring(1); this.modulePatterns = new Pattern[len]; @@ -280,7 +280,7 @@ public char[][] getIndexCategories() { @Override public boolean matchesDecodedKey(SearchPattern decodedPattern) { TypeDeclarationPattern pattern = (TypeDeclarationPattern) decodedPattern; - + // check type suffix if (this.typeSuffix != pattern.typeSuffix && this.typeSuffix != TYPE_SUFFIX) { if (!matchDifferentTypeSuffixes(this.typeSuffix, pattern.typeSuffix)) { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeParameterLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeParameterLocator.java index e3c06dcbb..d107e1cb3 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeParameterLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeParameterLocator.java @@ -141,7 +141,7 @@ public class TypeParameterLocator extends PatternLocator { public int resolveLevel(Binding binding) { if (binding == null) return INACCURATE_MATCH; if (!(binding instanceof TypeVariableBinding)) return IMPOSSIBLE_MATCH; - + return matchTypeParameter((TypeVariableBinding) binding, true); } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeParameterPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeParameterPattern.java index e72e51220..e3d2083f7 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeParameterPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeParameterPattern.java @@ -63,7 +63,7 @@ public class TypeParameterPattern extends JavaSearchPattern { this.name = typeParameter.getElementName().toCharArray(); // store type parameter name IMember member = typeParameter.getDeclaringMember(); this.declaringMemberName = member.getElementName().toCharArray(); // store type parameter declaring member name - + // For method type parameter, store also declaring class name and parameters type names if (member instanceof IMethod) { IMethod method = (IMethod) member; @@ -91,7 +91,7 @@ public class TypeParameterPattern extends JavaSearchPattern { IModuleDescription md = root.getModuleDescription(); if(md != null) { String module = md.getElementName(); - documentPath = root.getPath() + IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR + documentPath = root.getPath() + IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR + module + IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR + relativePath; } else { documentPath = root.getPath() + IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR + relativePath; @@ -101,18 +101,18 @@ public class TypeParameterPattern extends JavaSearchPattern { documentPath = path.toString(); relativePath = Util.relativePath(path, 1/*remove project segment*/); } - + 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, index.containerPath); if (access != JavaSearchScope.NOT_ENCLOSED) { // scope encloses the path - if (!requestor.acceptIndexMatch(documentPath, this, participant, access)) + if (!requestor.acceptIndexMatch(documentPath, this, participant, access)) throw new OperationCanceledException(); } } else if (scope.encloses(documentPath)) { - if (!requestor.acceptIndexMatch(documentPath, this, participant, null)) + if (!requestor.acceptIndexMatch(documentPath, this, participant, null)) throw new OperationCanceledException(); } } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java index 2fb0e7c7b..db9dab7b9 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java @@ -54,7 +54,7 @@ protected IJavaElement findElement(IJavaElement element, int accuracy) { if (accuracy != SearchMatch.A_ACCURATE) return null; // element that references the type must be included in the enclosing element - DeclarationOfReferencedTypesPattern declPattern = (DeclarationOfReferencedTypesPattern) this.pattern; + DeclarationOfReferencedTypesPattern declPattern = (DeclarationOfReferencedTypesPattern) this.pattern; while (element != null && !declPattern.enclosingElement.equals(element)) element = element.getParent(); return element; @@ -87,7 +87,7 @@ public int match(Reference node, MatchingNodeSet nodeSet) { // interested in Nam if (node instanceof SingleNameReference) { if (matchesName(this.pattern.simpleName, ((SingleNameReference) node).token)) - return nodeSet.addMatch(node, POSSIBLE_MATCH); // resolution is needed to find out if it is a type ref + return nodeSet.addMatch(node, POSSIBLE_MATCH); // resolution is needed to find out if it is a type ref } else { char[][] tokens = ((QualifiedNameReference) node).tokens; for (int i = 0, max = tokens.length; i < max; i++) @@ -215,9 +215,9 @@ protected void matchLevelAndReportImportRef(ImportReference importRef, Binding b int level = resolveLevel(refBinding); if (level >= INACCURATE_MATCH) { matchReportImportRef( - importRef, - binding, - locator.createImportHandle(importRef), + importRef, + binding, + locator.createImportHandle(importRef), level == ACCURATE_MATCH ? SearchMatch.A_ACCURATE : SearchMatch.A_INACCURATE, @@ -231,7 +231,7 @@ protected void matchLevelAndReportImportRef(ImportReference importRef, Binding b protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { if (this.isDeclarationOfReferencedTypesPattern) { if ((element = findElement(element, accuracy)) != null) { - SimpleSet knownTypes = ((DeclarationOfReferencedTypesPattern) this.pattern).knownTypes; + SimpleSet knownTypes = ((DeclarationOfReferencedTypesPattern) this.pattern).knownTypes; while (binding instanceof ReferenceBinding) { ReferenceBinding typeBinding = (ReferenceBinding) binding; reportDeclaration(typeBinding, 1, locator, knownTypes); @@ -245,7 +245,7 @@ protected void matchReportImportRef(ImportReference importRef, Binding binding, if (this.pattern.hasTypeArguments() && !this.isEquivalentMatch &&!this.isErasureMatch) { return; } - + // Return if fine grain is on and does not concern import reference if ((this.pattern.fineGrain != 0 && (this.pattern.fineGrain & IJavaSearchConstants.IMPORT_DECLARATION_TYPE_REFERENCE) == 0)) { return; @@ -260,7 +260,7 @@ protected void matchReportImportRef(ImportReference importRef, Binding binding, // binding is raw => only compatible erasure if pattern has type arguments this.match.setRule(this.match.getRule() & (~SearchPattern.R_FULL_MATCH)); } - + // Try to find best selection for match TypeBinding typeBinding = null; boolean lastButOne = false; @@ -363,7 +363,7 @@ protected void matchReportReference(ASTNode reference, IJavaElement element, IJa } else { accuracy ^= SearchMatch.A_CHECKED; } -// SH} +// SH} // Create search match TypeReferenceMatch refMatch = locator.newTypeReferenceMatch(element, elementBinding, accuracy, reference); refMatch.setLocalElement(localElement); @@ -411,7 +411,7 @@ protected void matchReportReference(QualifiedNameReference qNameRef, IJavaElemen } else if (binding instanceof ProblemBinding) { typeBinding = ((ProblemBinding) binding).searchType; } - break; + break; } if (typeBinding instanceof ProblemReferenceBinding) { ProblemReferenceBinding pbBinding = (ProblemReferenceBinding) typeBinding; @@ -426,7 +426,7 @@ protected void matchReportReference(QualifiedNameReference qNameRef, IJavaElemen // try to match all enclosing types for which the token matches as well. if (typeBinding instanceof ReferenceBinding) { - ReferenceBinding refBinding = (ReferenceBinding) typeBinding; + ReferenceBinding refBinding = (ReferenceBinding) typeBinding; while (refBinding != null && lastIndex >= 0) { if (resolveLevelForType(refBinding) == ACCURATE_MATCH) { if (locator.encloses(element)) { @@ -471,7 +471,7 @@ protected void matchReportReference(QualifiedTypeReference qTypeRef, IJavaElemen // try to match all enclosing types for which the token matches as well if (typeBinding instanceof ReferenceBinding) { - ReferenceBinding refBinding = (ReferenceBinding) typeBinding; + ReferenceBinding refBinding = (ReferenceBinding) typeBinding; while (refBinding != null && lastIndex >= 0) { if (resolveLevelForType(refBinding) != IMPOSSIBLE_MATCH) { if (locator.encloses(element)) { @@ -506,7 +506,7 @@ void matchReportReference(Expression expr, int lastIndex, TypeBinding refBinding // Try to refine accuracy ParameterizedTypeBinding parameterizedBinding = (ParameterizedTypeBinding)refBinding; updateMatch(parameterizedBinding, this.pattern.getTypeArguments(), this.pattern.hasTypeParameters(), 0, locator); - + // See whether it is necessary to report or not if (this.match.getRule() == 0) return; // impossible match boolean report = (this.isErasureMatch && this.match.isErasure()) || (this.isEquivalentMatch && this.match.isEquivalent()) || this.match.isExact(); @@ -596,7 +596,7 @@ protected void reportDeclaration(ASTNode reference, IJavaElement element, MatchL typeBinding = (TypeBinding) ((SingleNameReference) reference).binding; maxType = 1; } - + if (typeBinding instanceof ArrayBinding) typeBinding = ((ArrayBinding) typeBinding).leafComponentType; if (typeBinding == null || typeBinding instanceof BaseTypeBinding) return; @@ -679,7 +679,7 @@ protected int resolveLevel(NameReference nameRef) { return resolveLevelForType((ReferenceBinding) binding); if (((SingleNameReference) nameRef).isLabel) return IMPOSSIBLE_MATCH; - + return binding == null || binding instanceof ProblemBinding ? INACCURATE_MATCH : IMPOSSIBLE_MATCH; } @@ -785,7 +785,7 @@ protected int resolveLevelForTypeOrEnclosingTypes(char[] simpleNamePattern, char while (type != null) { int level = resolveLevelForType(type); if (level != IMPOSSIBLE_MATCH) return level; - + type = type.enclosingType(); } } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java index 1b401775f..8022c6ba0 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java @@ -20,17 +20,17 @@ import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.internal.core.util.Util; public class TypeReferencePattern extends IntersectingPattern { - + protected char[] qualification; protected char[] simpleName; - + protected char[] currentCategory; - + /* Optimization: case where simpleName == null */ public int segmentsSize; protected char[][] segments; protected int currentSegment; - + private final static char[][] CATEGORIES = { REF, ANNOTATION_REF }, CATEGORIES_ANNOT_REF = { ANNOTATION_REF }; @@ -39,15 +39,15 @@ public class TypeReferencePattern extends IntersectingPattern { public TypeReferencePattern(char[] qualification, char[] simpleName, int matchRule) { this(matchRule); - + this.qualification = this.isCaseSensitive ? qualification : CharOperation.toLowerCase(qualification); this.simpleName = (this.isCaseSensitive || this.isCamelCase) ? simpleName : CharOperation.toLowerCase(simpleName); - + if (simpleName == null) this.segments = this.qualification == null ? ONE_STAR_CHAR : CharOperation.splitOn('.', this.qualification); else this.segments = null; - + if (this.segments == null) if (this.qualification == null) this.segmentsSize = 0; @@ -55,7 +55,7 @@ public class TypeReferencePattern extends IntersectingPattern { this.segmentsSize = CharOperation.occurencesOf('.', this.qualification) + 1; else this.segmentsSize = this.segments.length; - + this.mustResolve = true; // always resolve (in case of a simple name reference being a potential match) } /* @@ -123,9 +123,9 @@ public class TypeReferencePattern extends IntersectingPattern { public char[] getIndexKey() { if (this.simpleName != null) return this.simpleName; - + // Optimization, e.g. type reference is 'org.eclipse.jdt.core.*' - if (this.currentSegment >= 0) + if (this.currentSegment >= 0) return this.segments[this.currentSegment]; return null; } @@ -136,7 +136,7 @@ public class TypeReferencePattern extends IntersectingPattern { @Override protected boolean hasNextQuery() { if (this.segments == null) return false; - + // Optimization, e.g. type reference is 'org.eclipse.jdt.core.*' // if package has at least 4 segments, don't look at the first 2 since they are mostly // redundant (e.g. in 'org.eclipse.jdt.core.*' 'org.eclipse' is used all the time) diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java index 449a1844f..8b55205fd 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java @@ -62,11 +62,11 @@ public VariablePattern(int patternKind, char[] name, int limitTo, int matchRule) this.name = (this.isCaseSensitive || this.isCamelCase) ? name : CharOperation.toLowerCase(name); } /* - * Returns whether a method declaration or message send will need to be resolved to + * Returns whether a method declaration or message send will need to be resolved to * find out if this method pattern matches it. */ protected boolean mustResolve() { // would like to change this so that we only do it if generic references are found return this.findReferences || this.fineGrain != 0; // always resolve (in case of a simple name reference being a potential match) -} +} } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/IJob.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/IJob.java index 263825ca4..158a30e9f 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/IJob.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/IJob.java @@ -43,7 +43,7 @@ public interface IJob { * Execute the current job, answer whether it was successful. */ public boolean execute(IProgressMonitor progress); - + /** * Returns this job's family */ |