From 155a0096c021ca269d555c16c8b7423a3c90761f Mon Sep 17 00:00:00 2001 From: cjaun Date: Thu, 12 Nov 2009 18:40:08 +0000 Subject: [294918] [search] Type hierarchy is not complete for multiple levels of inheritance --- .../org/eclipse/wst/jsdt/core/ITypeHierarchy.java | 50 ---- .../core/search/IJavaScriptSearchConstants.java | 41 ---- .../eclipse/wst/jsdt/core/search/SearchMatch.java | 22 +- .../wst/jsdt/core/search/SearchPattern.java | 47 +--- .../jsdt/internal/codeassist/CompletionEngine.java | 169 +------------ .../codeassist/InternalCompletionProposal.java | 4 +- .../internal/codeassist/RelevanceConstants.java | 4 - .../jsdt/internal/codeassist/SelectionEngine.java | 63 ----- .../wst/jsdt/internal/codeassist/impl/Engine.java | 2 +- .../jsdt/internal/compiler/env/IBinaryType.java | 9 - .../eclipse/wst/jsdt/internal/core/BinaryType.java | 80 +------ .../wst/jsdt/internal/core/JavaProject.java | 6 +- .../eclipse/wst/jsdt/internal/core/NameLookup.java | 68 ++---- .../jsdt/internal/core/SearchableEnvironment.java | 42 +--- .../wst/jsdt/internal/core/SelectionRequestor.java | 14 +- .../eclipse/wst/jsdt/internal/core/SourceType.java | 26 -- .../core/hierarchy/HierarchyBinaryType.java | 35 +-- .../internal/core/hierarchy/HierarchyBuilder.java | 34 +-- .../internal/core/hierarchy/HierarchyResolver.java | 122 +--------- .../internal/core/hierarchy/HierarchyType.java | 7 +- .../core/hierarchy/RegionBasedTypeHierarchy.java | 14 +- .../internal/core/hierarchy/TypeHierarchy.java | 263 +-------------------- .../internal/core/search/BasicSearchEngine.java | 51 ---- .../jsdt/internal/core/search/HierarchyScope.java | 4 +- .../core/search/indexing/IIndexConstants.java | 6 +- .../search/matching/ClassFileMatchLocator.java | 24 +- .../core/search/matching/ConstructorLocator.java | 7 +- .../core/search/matching/JavaSearchPattern.java | 45 +--- .../core/search/matching/MatchLocator.java | 66 +++--- .../core/search/matching/MatchingNodeSet.java | 14 +- .../core/search/matching/MethodLocator.java | 7 +- .../matching/MultiTypeDeclarationPattern.java | 12 - .../internal/core/search/matching/OrPattern.java | 9 +- .../core/search/matching/PatternLocator.java | 15 +- .../matching/QualifiedTypeDeclarationPattern.java | 11 +- .../search/matching/SuperTypeReferenceLocator.java | 8 +- .../search/matching/SuperTypeReferencePattern.java | 6 +- .../search/matching/TypeDeclarationLocator.java | 8 - .../search/matching/TypeDeclarationPattern.java | 12 - .../core/search/matching/TypeReferenceLocator.java | 4 - .../codemanipulation/AddImportsOperation.java | 5 - .../jsdt/internal/corext/refactoring/Checks.java | 2 +- .../refactoring/rename/RippleMethodFinder2.java | 7 +- .../structure/ExtractSupertypeProcessor.java | 2 +- .../structure/MemberVisibilityAdjustor.java | 42 ++-- .../structure/MoveInstanceMethodProcessor.java | 2 +- .../structure/PullUpRefactoringProcessor.java | 2 +- .../template/java/CompilationUnitCompletion.java | 6 +- .../internal/corext/template/java/JavaContext.java | 5 - .../jsdt/internal/corext/util/JavaModelUtil.java | 2 +- .../wst/jsdt/internal/corext/util/SearchUtils.java | 4 +- .../jsdt/internal/corext/util/TypeInfoFilter.java | 10 - .../ui/dialogs/FilteredTypesSelectionDialog.java | 12 +- .../jsdt/internal/ui/dialogs/TypeInfoViewer.java | 2 +- .../internal/ui/dialogs/TypeSelectionDialog2.java | 2 +- .../internal/ui/refactoring/PullUpMethodPage.java | 4 +- .../jsdt/internal/ui/search/JavaSearchQuery.java | 4 +- .../ui/text/JavaOutlineInformationControl.java | 6 +- .../ui/text/java/ContentAssistHistory.java | 2 +- .../ui/typehierarchy/MethodsContentProvider.java | 4 +- .../ui/typehierarchy/SubTypeHierarchyViewer.java | 2 +- .../ui/typehierarchy/SuperTypeHierarchyViewer.java | 4 +- .../typehierarchy/TraditionalHierarchyViewer.java | 2 +- .../jsdt/ui/IJavaScriptElementSearchConstants.java | 14 -- .../eclipse/wst/jsdt/ui/JSdocContentAccess.java | 4 +- .../src/org/eclipse/wst/jsdt/ui/JavaScriptUI.java | 12 +- 66 files changed, 180 insertions(+), 1414 deletions(-) diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/ITypeHierarchy.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/ITypeHierarchy.java index e3e151ac..082e15e6 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/ITypeHierarchy.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/ITypeHierarchy.java @@ -98,29 +98,6 @@ IType[] getAllSubtypes(IType type); * array if none. */ IType[] getAllSuperclasses(IType type); -/** - * Returns all resolved supertypes of the - * given type, in bottom-up order. An empty array - * is returned if there are no resolved supertypes for the - * given type. - *

NOTE: once a type hierarchy has been created, it is more efficient to - * query the hierarchy for supertypes than to query a type recursively up - * the supertype chain. Querying an element performs a dynamic resolution, - * whereas the hierarchy returns a pre-computed result. - * - * @param type the given type - * @return all resolved supertypes of the given class, in bottom-up order, an empty array - * if none - */ -IType[] getAllSupertypes(IType type); -/** - * Returns all types in this type hierarchy's graph, in no particular - * order. Any types in the creation region which were not resolved to - * have any subtypes or supertypes are not included in the result. - * - * @return all types in this type hierarchy's grap - */ -IType[] getAllTypes(); /** * Return the flags associated with the given type (would be equivalent to IMember.getFlags()), @@ -151,19 +128,6 @@ IType[] getRootClasses(); * type hierarchy's graph, an empty collection if none. */ IType[] getSubclasses(IType type); -/** - * Returns the direct resolved subtypes of the given type, - * in no particular order, limited to the types in this - * type hierarchy's graph. - * If the type is a class, this returns the resolved subclasses. - * If the type is an interface, this returns both the classes which implement - * the interface and the interfaces which extend it. - * - * @param type the given type - * @return the direct resolved subtypes of the given type limited to the types in this - * type hierarchy's graph - */ -IType[] getSubtypes(IType type); /** * Returns the resolved superclass of the given class, * or null if the given class has no superclass, @@ -177,20 +141,6 @@ IType[] getSubtypes(IType type); * type is an interface */ IType getSuperclass(IType type); -/** - * Returns the resolved supertypes of the given type, - * in no particular order, limited to the types in this - * type hierarchy's graph. - * For classes, this returns its superclass and the interfaces that the class implements. - * For interfaces, this returns the interfaces that the interface extends. As a consequence - * java.lang.Object is NOT considered to be a supertype of any interface - * type. - * - * @param type the given type - * @return the resolved supertypes of the given type limited to the types in this - * type hierarchy's graph - */ -IType[] getSupertypes(IType type); /** * Returns the type this hierarchy was computed for. * Returns null if this hierarchy was computed for a region. diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/IJavaScriptSearchConstants.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/IJavaScriptSearchConstants.java index e57c685d..243241bd 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/IJavaScriptSearchConstants.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/IJavaScriptSearchConstants.java @@ -68,47 +68,6 @@ public interface IJavaScriptSearchConstants { */ int CLASS= 5; - /** - * The searched element is an interface. - * More selective than using {@link #TYPE}. - */ - int INTERFACE= 6; - - /** - * The searched element is an enum. - * More selective than using {@link #TYPE}. - * - */ - int ENUM= 7; - - /** - * The searched element is an annotation type. - * More selective than using {@link #TYPE}. - * - */ - int ANNOTATION_TYPE= 8; - - /** - * The searched element is a class or enum type. - * More selective than using {@link #TYPE}. - * - */ - int CLASS_AND_ENUM= 9; - - /** - * The searched element is a class or interface type. - * More selective than using {@link #TYPE}. - * - */ - int CLASS_AND_INTERFACE= 10; - - /** - * The searched element is an interface or annotation type. - * More selective than using {@link #TYPE}. - * - */ - int INTERFACE_AND_ANNOTATION= 11; - /** * The searched element is a field. */ diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/SearchMatch.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/SearchMatch.java index 498805c0..13394b6d 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/SearchMatch.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/SearchMatch.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -62,8 +62,7 @@ public class SearchMatch { // 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; + SearchPattern.R_EQUIVALENT_MATCH; private int rule = ALL_GENERIC_FLAVORS; // store other necessary information @@ -182,20 +181,7 @@ public class SearchMatch { * */ public final boolean isEquivalent() { - return isErasure() && (this.rule & SearchPattern.R_EQUIVALENT_MATCH) != 0; - } - - /** - * 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 true if match element has same erasure - * false otherwise - * - */ - public final boolean isErasure() { - return (this.rule & SearchPattern.R_ERASURE_MATCH) != 0; + return (this.rule & SearchPattern.R_EQUIVALENT_MATCH) != 0; } /** @@ -361,8 +347,6 @@ public class SearchMatch { buffer.append("EXACT"); //$NON-NLS-1$ } else if ((this.rule & SearchPattern.R_EQUIVALENT_MATCH) != 0) { buffer.append("EQUIVALENT"); //$NON-NLS-1$ - } else if ((this.rule & SearchPattern.R_ERASURE_MATCH) != 0) { - buffer.append("ERASURE"); //$NON-NLS-1$ } buffer.append("\n raw="); //$NON-NLS-1$ buffer.append(this.raw); diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/SearchPattern.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/SearchPattern.java index 07fe5eab..812eb37d 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/SearchPattern.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/SearchPattern.java @@ -36,7 +36,6 @@ import org.eclipse.wst.jsdt.internal.core.search.matching.OrPattern; import org.eclipse.wst.jsdt.internal.core.search.matching.PackageDeclarationPattern; import org.eclipse.wst.jsdt.internal.core.search.matching.PackageReferencePattern; import org.eclipse.wst.jsdt.internal.core.search.matching.QualifiedTypeDeclarationPattern; -import org.eclipse.wst.jsdt.internal.core.search.matching.SuperTypeReferencePattern; import org.eclipse.wst.jsdt.internal.core.search.matching.TypeDeclarationPattern; import org.eclipse.wst.jsdt.internal.core.search.matching.TypeReferencePattern; @@ -99,28 +98,6 @@ public abstract class SearchPattern extends InternalSearchPattern { */ public static final int R_CASE_SENSITIVE = 0x0008; - /** - * Match rule: The search pattern matches search results as raw/parameterized types/methods with same erasure. - * This mode has no effect on other javascript elements search.
- * Type search example: - *

- * Method search example: - * - * Can be combined to all other match rules, e.g. {@link #R_CASE_SENSITIVE} | {@link #R_ERASURE_MATCH} - * This rule is not activated by default, so raw types or parameterized types with same erasure will not be found - * for pattern List<String>, - * Note that with this pattern, the match selection will be only on the erasure even for parameterized types. - * - */ - public static final int R_ERASURE_MATCH = 0x0010; - /** * Match rule: The search pattern matches search results as raw/parameterized types/methods with equivalent type parameters. * This mode has no effect on other javascript elements search.
@@ -215,7 +192,7 @@ public abstract class SearchPattern extends InternalSearchPattern { public SearchPattern(int matchRule) { this.matchRule = matchRule; // Set full match implicit mode - if ((matchRule & (R_EQUIVALENT_MATCH | R_ERASURE_MATCH )) == 0) { + if ((matchRule & R_EQUIVALENT_MATCH) == 0) { this.matchRule |= R_FULL_MATCH; } } @@ -1095,18 +1072,6 @@ public static SearchPattern createPattern(String stringPattern, int searchFor, i switch (searchFor) { case IJavaScriptSearchConstants.CLASS: return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.CLASS_SUFFIX); - case IJavaScriptSearchConstants.CLASS_AND_INTERFACE: - return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.CLASS_AND_INTERFACE_SUFFIX); - case IJavaScriptSearchConstants.CLASS_AND_ENUM: - return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.CLASS_AND_ENUM_SUFFIX); - case IJavaScriptSearchConstants.INTERFACE: - return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.INTERFACE_SUFFIX); - case IJavaScriptSearchConstants.INTERFACE_AND_ANNOTATION: - return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.INTERFACE_AND_ANNOTATION_SUFFIX); - case IJavaScriptSearchConstants.ENUM: - return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.ENUM_SUFFIX); - case IJavaScriptSearchConstants.ANNOTATION_TYPE: - return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.ANNOTATION_TYPE_SUFFIX); case IJavaScriptSearchConstants.TYPE: return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.TYPE_SUFFIX); case IJavaScriptSearchConstants.FUNCTION: @@ -1176,7 +1141,7 @@ public static SearchPattern createPattern(String stringPattern, int searchFor, i * @return a search pattern for a JavaScript element or null if the given element is ill-formed */ public static SearchPattern createPattern(IJavaScriptElement element, int limitTo) { - return createPattern(element, limitTo, R_EXACT_MATCH | R_CASE_SENSITIVE | R_ERASURE_MATCH); + return createPattern(element, limitTo, R_EXACT_MATCH | R_CASE_SENSITIVE); } /** @@ -1541,12 +1506,6 @@ private static SearchPattern createTypePattern(char[] simpleName, char[] package simpleName, typeSignature, matchRule); - case IJavaScriptSearchConstants.IMPLEMENTORS : - return new SuperTypeReferencePattern( - CharOperation.concatWith(packageName, enclosingTypeNames, '.'), - simpleName, - SuperTypeReferencePattern.ONLY_SUPER_INTERFACES, - matchRule); case IJavaScriptSearchConstants.ALL_OCCURRENCES : return new OrPattern( new TypeDeclarationPattern( @@ -1662,8 +1621,6 @@ private static SearchPattern createTypePattern(String patternString, int limitTo return new QualifiedTypeDeclarationPattern(qualificationChars, typeChars, indexSuffix, matchRule); case IJavaScriptSearchConstants.REFERENCES : return new TypeReferencePattern(qualificationChars, typeChars, typeSignature, matchRule); - case IJavaScriptSearchConstants.IMPLEMENTORS : - return new SuperTypeReferencePattern(qualificationChars, typeChars, SuperTypeReferencePattern.ONLY_SUPER_INTERFACES, indexSuffix, matchRule); case IJavaScriptSearchConstants.ALL_OCCURRENCES : return new OrPattern( new QualifiedTypeDeclarationPattern(qualificationChars, typeChars, indexSuffix, matchRule),// cannot search for explicit member types diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/CompletionEngine.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/CompletionEngine.java index 4be72100..47efe8aa 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/CompletionEngine.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/CompletionEngine.java @@ -360,10 +360,7 @@ public final class CompletionEngine ImportBinding[] favoriteReferenceBindings; boolean assistNodeIsClass; - boolean assistNodeIsEnum; boolean assistNodeIsException; - boolean assistNodeIsInterface; - boolean assistNodeIsAnnotation; boolean assistNodeIsConstructor; boolean assistNodeIsSuperType; int assistNodeInJavadoc = 0; @@ -1359,7 +1356,6 @@ public final class CompletionEngine this.assistNodeIsClass = singleRef.isClass(); this.assistNodeIsException = singleRef.isException(); - this.assistNodeIsInterface = singleRef.isInterface(); this.assistNodeIsConstructor = singleRef.isConstructorType; this.assistNodeIsSuperType = singleRef.isSuperType(); @@ -1577,7 +1573,6 @@ public final class CompletionEngine this.assistNodeIsClass = ref.isClass(); this.assistNodeIsException = ref.isException(); - this.assistNodeIsInterface = ref.isInterface(); this.assistNodeIsSuperType = ref.isSuperType(); this.completionToken = ref.completionIdentifier; @@ -4362,10 +4357,6 @@ public final class CompletionEngine if(!this.insideQualifiedReference) { if(this.assistNodeIsClass) { if(!memberType.isClass()) continue next; - } else if(this.assistNodeIsInterface) { - continue next; - } else if (this.assistNodeIsAnnotation) { - continue next; } } @@ -5171,118 +5162,6 @@ public final class CompletionEngine return proposal; } - // Helper method for findMethods(char[], TypeBinding[], ReferenceBinding, Scope, ObjectVector, boolean, boolean, boolean) - private void findLocalMethodsOfStaticImports( - char[] methodName, - MethodBinding[] methods, - Scope scope, - ObjectVector methodsFound, - ReferenceBinding receiverType, - InvocationSite invocationSite) { - - ObjectVector newMethodsFound = new ObjectVector(); - - next : for (int f = methods.length; --f >= 0;) { - MethodBinding method = methods[f]; - - if (method.isDefaultAbstract()) continue next; - - if (method.isConstructor()) continue next; - - if (!method.isStatic()) continue next; - - if (this.options.checkDeprecation && - method.isViewedAsDeprecated() && - !scope.isDefinedInSameUnit(method.declaringClass)) - continue next; - - if (this.options.checkVisibility - && !method.canBeSeenBy(receiverType, invocationSite, scope)) continue next; - - if (!CharOperation.equals(methodName, method.selector, false /* ignore case */) - && !(this.options.camelCaseMatch && CharOperation.camelCaseMatch(methodName, method.selector))) - continue next; - - for (int i = methodsFound.size; --i >= 0;) { - Object[] other = (Object[]) methodsFound.elementAt(i); - MethodBinding otherMethod = (MethodBinding) other[0]; - ReferenceBinding otherReceiverType = (ReferenceBinding) other[1]; - if (method == otherMethod && receiverType == otherReceiverType) - continue next; - - if (CharOperation.equals(method.selector, otherMethod.selector, true)) { - if (lookupEnvironment.methodVerifier().doesMethodOverride(otherMethod, method)) { - continue next; - } - } - } - - newMethodsFound.add(new Object[]{method, receiverType}); - - int length = method.parameters.length; - char[][] parameterPackageNames = new char[length][]; - char[][] parameterTypeNames = new char[length][]; - - for (int i = 0; i < length; i++) { - TypeBinding type = method.original().parameters[i]; - parameterPackageNames[i] = type.qualifiedPackageName(); - parameterTypeNames[i] = type.qualifiedSourceName(); - } - char[][] parameterNames = findMethodParameterNames(method,parameterTypeNames); - - char[] completion = CharOperation.NO_CHAR; - - int previousStartPosition = this.startPosition; - - // nothing to insert - do not want to replace the existing selector & arguments - if (this.source != null - && this.source.length > this.endPosition - && this.source[this.endPosition] == '(') { - completion = method.selector; - } else { - completion = CharOperation.concat(method.selector, new char[] { '(', ')' }); - } - - int relevance = computeBaseRelevance(); - relevance += computeRelevanceForResolution(); - relevance += computeRelevanceForInterestingProposal(); - relevance += computeRelevanceForCaseMatching(methodName, method.selector); - relevance += computeRelevanceForExpectingType(method.returnType); - relevance += computeRelevanceForStatic(true, method.isStatic()); - relevance += computeRelevanceForQualification(false); - relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); - - this.noProposal = false; - if(!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) { - CompletionProposal proposal = this.createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); - proposal.setDeclarationSignature(getSignature(method.declaringClass)); - proposal.setSignature(getSignature(method)); - MethodBinding original = method.original(); - if(original != method) { - proposal.setOriginalSignature(getSignature(original)); - } - proposal.setDeclarationPackageName(method.declaringClass.qualifiedPackageName()); - proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); - proposal.setParameterPackageNames(parameterPackageNames); - proposal.setParameterTypeNames(parameterTypeNames); - proposal.setPackageName(method.returnType.qualifiedPackageName()); - proposal.setTypeName(method.returnType.qualifiedSourceName()); - proposal.setName(method.selector); - proposal.setCompletion(completion); - proposal.setFlags(method.modifiers); - proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); - proposal.setRelevance(relevance); - if(parameterNames != null) proposal.setParameterNames(parameterNames); - this.requestor.accept(proposal); - if(DEBUG) { - this.printDebug(proposal); - } - } - this.startPosition = previousStartPosition; - } - - methodsFound.addAll(newMethodsFound); - } int computeRelevanceForCaseMatching(char[] token, char[] proposalName){ if (this.options.camelCaseMatch) { if(CharOperation.equals(token, proposalName, true /* do not ignore case */)) { @@ -5305,30 +5184,12 @@ public final class CompletionEngine } return 0; } - private int computeRelevanceForAnnotation(){ - if(this.assistNodeIsAnnotation) { - return R_ANNOTATION; - } - return 0; - } private int computeRelevanceForClass(){ if(this.assistNodeIsClass) { return R_CLASS; } return 0; } - private int computeRelevanceForEnum(){ - if(this.assistNodeIsEnum) { - return R_ENUM; - } - return 0; - } - private int computeRelevanceForInterface(){ - if(this.assistNodeIsInterface) { - return R_INTERFACE; - } - return 0; - } private int computeRelevanceForMissingElements(boolean hasProblems) { if (!hasProblems) { return R_NO_PROBLEMS; @@ -5958,10 +5819,6 @@ public final class CompletionEngine if(this.assistNodeIsClass) { if(!localType.isClass()) continue next; - } else if(this.assistNodeIsInterface) { - continue next; - } else if (this.assistNodeIsAnnotation) { - continue next; } int relevance = computeBaseRelevance(); @@ -6126,10 +5983,6 @@ public final class CompletionEngine } else if (!CharOperation.prefixEquals(token, sourceType.sourceName, false) && !(this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, sourceType.sourceName))) continue ; - if (this.assistNodeIsAnnotation) { - continue next; - } - for (int j = typesFound.size; --j >= 0;) { ReferenceBinding otherType = (ReferenceBinding) typesFound.elementAt(j); @@ -6140,10 +5993,6 @@ public final class CompletionEngine if(this.assistNodeIsClass) { if(!sourceType.isClass()) continue next; - } else if(this.assistNodeIsInterface) { - continue next; - } else if (this.assistNodeIsAnnotation) { - continue next; } int relevance = computeBaseRelevance(); @@ -6166,7 +6015,7 @@ public final class CompletionEngine } } - if (isEmptyPrefix && !this.assistNodeIsAnnotation) { + if (isEmptyPrefix) { if(proposeType && this.expectedTypesPtr > -1) { next : for (int i = 0; i <= this.expectedTypesPtr; i++) { if(this.expectedTypes[i] instanceof ReferenceBinding) { @@ -6226,10 +6075,6 @@ public final class CompletionEngine if(this.assistNodeIsClass) { if(!refBinding.isClass()) continue next; - } else if(this.assistNodeIsInterface) { - continue next; - } else if (this.assistNodeIsAnnotation) { - continue next; } int relevance = computeBaseRelevance(); @@ -6286,12 +6131,6 @@ public final class CompletionEngine int searchFor = IJavaScriptSearchConstants.TYPE; if(this.assistNodeIsClass) { searchFor = IJavaScriptSearchConstants.CLASS; - } else if(this.assistNodeIsInterface) { - searchFor = IJavaScriptSearchConstants.INTERFACE_AND_ANNOTATION; - } else if(this.assistNodeIsEnum) { - searchFor = IJavaScriptSearchConstants.ENUM; - } else if(this.assistNodeIsAnnotation) { - searchFor = IJavaScriptSearchConstants.ANNOTATION_TYPE; } this.nameEnvironment.findTypes( token, @@ -6401,12 +6240,6 @@ public final class CompletionEngine int searchFor = IJavaScriptSearchConstants.TYPE; if(this.assistNodeIsClass) { searchFor = IJavaScriptSearchConstants.CLASS; - } else if(this.assistNodeIsInterface) { - searchFor = IJavaScriptSearchConstants.INTERFACE_AND_ANNOTATION; - } else if(this.assistNodeIsEnum) { - searchFor = IJavaScriptSearchConstants.ENUM; - } else if(this.assistNodeIsAnnotation) { - searchFor = IJavaScriptSearchConstants.ANNOTATION_TYPE; } this.nameEnvironment.findTypes( qualifiedName, diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/InternalCompletionProposal.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/InternalCompletionProposal.java index 35e732bf..07becc65 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/InternalCompletionProposal.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/InternalCompletionProposal.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. + * Copyright (c) 2004, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -97,7 +97,7 @@ public class InternalCompletionProposal { // TODO (david) shouldn't it be NameLookup.ACCEPT_ALL ? NameLookup.Answer answer = this.nameLookup.findType(new String(tName), false, - NameLookup.ACCEPT_CLASSES & NameLookup.ACCEPT_INTERFACES, + NameLookup.ACCEPT_CLASSES, true/* consider secondary types */, false/* do NOT wait for indexes */, false/*don't check restrictions*/, diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/RelevanceConstants.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/RelevanceConstants.java index 2e599f1d..ec433632 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/RelevanceConstants.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/RelevanceConstants.java @@ -19,12 +19,8 @@ public interface RelevanceConstants { int R_EXACT_NAME = 4; int R_EXPECTED_TYPE = 20; int R_EXACT_EXPECTED_TYPE = 30; - int R_INTERFACE = 20; int R_CLASS = 20; - int R_ENUM = 20; - int R_ANNOTATION = 20; int R_EXCEPTION = 20; - int R_ENUM_CONSTANT = 20; int R_ABSTRACT_METHOD = 20; int R_NON_STATIC = 11; int R_UNQUALIFIED = 3; diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/SelectionEngine.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/SelectionEngine.java index ec4272a6..8facc266 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/SelectionEngine.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/SelectionEngine.java @@ -102,16 +102,7 @@ public final class SelectionEngine extends Engine implements ISearchRequestor { private char[][][] acceptedClasses; private int[] acceptedClassesModifiers; - private char[][][] acceptedInterfaces; - private int[] acceptedInterfacesModifiers; - private char[][][] acceptedEnums; - private int[] acceptedEnumsModifiers; - private char[][][] acceptedAnnotations; - private int[] acceptedAnnotationsModifiers; int acceptedClassesCount; - int acceptedInterfacesCount; - int acceptedEnumsCount; - int acceptedAnnotationsCount; boolean noProposal = true; CategorizedProblem problem = null; @@ -311,60 +302,6 @@ public final class SelectionEngine extends Engine implements ISearchRequestor { this.acceptedClassesModifiers = null; this.acceptedClassesCount = 0; } - if(this.acceptedInterfaces != null){ - this.acceptedAnswer = true; - for (int i = 0; i < this.acceptedInterfacesCount; i++) { - this.noProposal = false; - this.requestor.acceptType( - this.acceptedInterfaces[i][0], - null, - this.acceptedInterfaces[i][1], - this.acceptedInterfacesModifiers[i], - false, - null, - this.actualSelectionStart, - this.actualSelectionEnd); - } - this.acceptedInterfaces = null; - this.acceptedInterfacesModifiers = null; - this.acceptedInterfacesCount = 0; - } - if(this.acceptedAnnotations != null){ - this.acceptedAnswer = true; - for (int i = 0; i < this.acceptedAnnotationsCount; i++) { - this.noProposal = false; - this.requestor.acceptType( - this.acceptedAnnotations[i][0], - null, - this.acceptedAnnotations[i][1], - this.acceptedAnnotationsModifiers[i], - false, - null, - this.actualSelectionStart, - this.actualSelectionEnd); - } - this.acceptedAnnotations = null; - this.acceptedAnnotationsModifiers = null; - this.acceptedAnnotationsCount = 0; - } - if(this.acceptedEnums != null){ - this.acceptedAnswer = true; - for (int i = 0; i < this.acceptedEnumsCount; i++) { - this.noProposal = false; - this.requestor.acceptType( - this.acceptedEnums[i][0], - null, - this.acceptedEnums[i][1], - this.acceptedEnumsModifiers[i], - false, - null, - this.actualSelectionStart, - this.actualSelectionEnd); - } - this.acceptedEnums = null; - this.acceptedEnumsModifiers = null; - this.acceptedEnumsCount = 0; - } } private boolean checkSelection( char[] source, diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/impl/Engine.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/impl/Engine.java index 787a6a43..0a49111f 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/impl/Engine.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/impl/Engine.java @@ -235,7 +235,7 @@ public abstract class Engine implements ITypeRequestor { String.valueOf(typeName), String.valueOf(conflictingImportName), false, - NameLookup.ACCEPT_ALL, + NameLookup.ACCEPT_CLASSES, false/*don't check restrictions*/) != null) { return true; } diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/env/IBinaryType.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/env/IBinaryType.java index 15a362d6..544f6c65 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/env/IBinaryType.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/env/IBinaryType.java @@ -41,15 +41,6 @@ IBinaryField[] getFields(); * @return the receiver's signature, null if none */ char[] getGenericSignature(); -/** - * Answer the resolved names of the receiver's interfaces in the - * class file format as specified in section 4.2 of the Java 2 VM spec - * or null if the array is empty. - * - * For example, java.lang.String is java/lang/String. - */ - -char[][] getInterfaceNames(); /** * Answer the receiver's nested types or null if the array is empty. * diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/BinaryType.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/BinaryType.java index bff69f7b..9cd6f3a8 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/BinaryType.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/BinaryType.java @@ -414,15 +414,7 @@ public String getKey(boolean forceOpen) throws JavaScriptModelException { public IFunction getFunction(String selector, String[] parameterTypeSignatures) { return new BinaryMethod(this, selector, parameterTypeSignatures); } -/* - * @see IType#getMethods() - */ -/** - * @deprecated Use {@link #getFunctions()} instead - */ -public IFunction[] getMethods() throws JavaScriptModelException { - return getFunctions(); -} + /* * @see IType#getMethods() */ @@ -521,76 +513,6 @@ public String getSuperclassName() throws JavaScriptModelException { } return new String(ClassFile.translatedName(superclassName)); } -/* - * @see IType#getSuperInterfaceNames() - */ -public String[] getSuperInterfaceNames() throws JavaScriptModelException { - IBinaryType info = (IBinaryType) getElementInfo(); - char[][] names= info.getInterfaceNames(); - int length; - if (names == null || (length = names.length) == 0) { - return CharOperation.NO_STRINGS; - } - names= ClassFile.translatedNames(names); - String[] strings= new String[length]; - for (int i= 0; i < length; i++) { - strings[i]= new String(names[i]); - } - return strings; -} - -/** - * @see IType#getSuperInterfaceTypeSignatures() - * @since 3.0 - */ -public String[] getSuperInterfaceTypeSignatures() throws JavaScriptModelException { - IBinaryType info = (IBinaryType) getElementInfo(); - char[] genericSignature = info.getGenericSignature(); - if (genericSignature != null) { - ArrayList interfaces = new ArrayList(); - int signatureLength = genericSignature.length; - // skip type parameters - int index = 0; - if (genericSignature[0] == '<') { - int count = 1; - while (count > 0 && ++index < signatureLength) { - switch (genericSignature[index]) { - case '<': - count++; - break; - case '>': - count--; - break; - } - } - index++; - } - // skip superclass - index = Util.scanClassTypeSignature(genericSignature, index) + 1; - while (index < signatureLength) { - int start = index; - index = Util.scanClassTypeSignature(genericSignature, start) + 1; - char[] interfaceSig = CharOperation.subarray(genericSignature, start, index); - interfaces.add(new String(ClassFile.translatedName(interfaceSig))); - } - int size = interfaces.size(); - String[] result = new String[size]; - interfaces.toArray(result); - return result; - } else { - char[][] names= info.getInterfaceNames(); - int length; - if (names == null || (length = names.length) == 0) { - return CharOperation.NO_STRINGS; - } - names= ClassFile.translatedNames(names); - String[] strings= new String[length]; - for (int i= 0; i < length; i++) { - strings[i]= new String(Signature.createTypeSignature(names[i], true)); - } - return strings; - } -} /** * @see IType#getTypeParameterSignatures() diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaProject.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaProject.java index 1d3104db..26635f10 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaProject.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaProject.java @@ -1168,7 +1168,7 @@ public class JavaProject lookup.findType( qualifiedName, false, - NameLookup.ACCEPT_ALL, + NameLookup.ACCEPT_CLASSES, true/* consider secondary types */, false/* do NOT wait for indexes */, false/*don't check restrictions*/, @@ -1277,7 +1277,7 @@ public class JavaProject NameLookup.Answer answer = lookup.findType( fullyQualifiedName, false, - NameLookup.ACCEPT_ALL, + NameLookup.ACCEPT_CLASSES, considerSecondaryTypes, true, /* wait for indexes (only if consider secondary types)*/ false/*don't check restrictions*/, @@ -1321,7 +1321,7 @@ public class JavaProject typeQualifiedName, packageName, false, - NameLookup.ACCEPT_ALL, + NameLookup.ACCEPT_CLASSES, considerSecondaryTypes, true, // wait for indexes (in case we need to consider secondary types) false/*don't check restrictions*/, diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/NameLookup.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/NameLookup.java index 98bed1ee..561b0ec6 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/NameLookup.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/NameLookup.java @@ -25,13 +25,13 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Path; import org.eclipse.wst.jsdt.core.IClassFile; -import org.eclipse.wst.jsdt.core.IIncludePathEntry; -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; import org.eclipse.wst.jsdt.core.IField; +import org.eclipse.wst.jsdt.core.IFunction; +import org.eclipse.wst.jsdt.core.IIncludePathEntry; import org.eclipse.wst.jsdt.core.IInitializer; import org.eclipse.wst.jsdt.core.IJavaScriptElement; import org.eclipse.wst.jsdt.core.IJavaScriptProject; -import org.eclipse.wst.jsdt.core.IFunction; +import org.eclipse.wst.jsdt.core.IJavaScriptUnit; import org.eclipse.wst.jsdt.core.IOpenable; import org.eclipse.wst.jsdt.core.IPackageFragment; import org.eclipse.wst.jsdt.core.IPackageFragmentRoot; @@ -48,7 +48,6 @@ import org.eclipse.wst.jsdt.core.search.IJavaScriptSearchConstants; import org.eclipse.wst.jsdt.core.search.IJavaScriptSearchScope; import org.eclipse.wst.jsdt.core.search.SearchPattern; import org.eclipse.wst.jsdt.internal.compiler.ast.ASTNode; -import org.eclipse.wst.jsdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.wst.jsdt.internal.compiler.env.AccessRestriction; import org.eclipse.wst.jsdt.internal.compiler.env.AccessRuleSet; import org.eclipse.wst.jsdt.internal.compiler.lookup.Binding; @@ -115,26 +114,6 @@ public class NameLookup implements SuffixConstants { */ public static final int ACCEPT_CLASSES = ASTNode.Bit2; - /** - * Accept flag for specifying interfaces. - */ - public static final int ACCEPT_INTERFACES = ASTNode.Bit3; - - /** - * Accept flag for specifying enums. - */ - public static final int ACCEPT_ENUMS = ASTNode.Bit4; - - /** - * Accept flag for specifying annotations. - */ - public static final int ACCEPT_ANNOTATIONS = ASTNode.Bit5; - - /* - * Accept flag for all kinds of types - */ - public static final int ACCEPT_ALL = ACCEPT_CLASSES | ACCEPT_INTERFACES | ACCEPT_ENUMS | ACCEPT_ANNOTATIONS; - public static boolean VERBOSE = false; private static final IType[] NO_TYPES = {}; @@ -376,27 +355,10 @@ public class NameLookup implements SuffixConstants { * * Otherwise, false is returned. */ - protected boolean acceptType(IType type, int acceptFlags, boolean isSourceType) { + protected boolean acceptType(IType type) { if (!type.exists()) return false; - if (acceptFlags == 0 || acceptFlags == ACCEPT_ALL) - return true; // no flags or all flags, always accepted - try { - int kind = TypeDeclaration.kind(((SourceTypeElementInfo) ((SourceType) type).getElementInfo()).getModifiers()); - -// int kind = isSourceType -// ? TypeDeclaration.kind(((SourceTypeElementInfo) ((SourceType) type).getElementInfo()).getModifiers()) -// : TypeDeclaration.kind(((IBinaryType) ((BinaryType) type).getElementInfo()).getModifiers()); - switch (kind) { - case TypeDeclaration.CLASS_DECL : - return (acceptFlags & ACCEPT_CLASSES) != 0; - default: - //case IGenericType.ANNOTATION_TYPE : - return (acceptFlags & ACCEPT_ANNOTATIONS) != 0; - } - } catch (JavaScriptModelException npe) { - return false; // the class is not present, do not accept. - } + return true; // no flags or class always accepted } protected boolean doAcceptBinding(IJavaScriptElement element, int bindingType, boolean isSourceType,IJavaElementRequestor requestor) { @@ -886,7 +848,7 @@ public class NameLookup implements SuffixConstants { ArrayList found = new ArrayList(); for (int i= 0; i < length; i++) { - type = findType(typeName, packages[i], false, NameLookup.ACCEPT_ALL); + type = findType(typeName, packages[i], false, NameLookup.ACCEPT_CLASSES); if (type != null && type.exists()) { found.add(type); } @@ -1617,7 +1579,7 @@ public class NameLookup implements SuffixConstants { case Binding.TYPE: case Binding.TYPE | Binding.PACKAGE: IType type = classFile.getType(name); - if (acceptType(type, acceptFlags, false/*not a source type*/)) { + if (acceptType(type)) { acceptedCUs.add(classFile); requestor.acceptType(type); } @@ -1669,7 +1631,7 @@ public class NameLookup implements SuffixConstants { if ((Binding.TYPE & bindingType)!=0) { IType thisType = classFile.getType(name); - if (acceptType(thisType, acceptFlags, false/*not a source type*/)) { + if (acceptType(thisType)) { acceptedCUs.add(classFile); requestor.acceptType(thisType); } @@ -1713,7 +1675,7 @@ public class NameLookup implements SuffixConstants { IType type = ((ClassFile) classFile).getType(); String typeName = type.getElementName(); if (typeName.length() > 0 && !Character.isDigit(typeName.charAt(0))) { //not an anonymous type - if (nameMatches(unqualifiedName, type, true/*partial match*/) && acceptType(type, acceptFlags, false/*not a source type*/)) + if (nameMatches(unqualifiedName, type, true/*partial match*/) && acceptType(type)) requestor.acceptType(type); } } @@ -1755,7 +1717,7 @@ public class NameLookup implements SuffixConstants { // continue; IType type = ((IJavaScriptUnit) cu).getType(name); //type = getMemberType(type, name, firstDot); - if (acceptType(type, acceptFlags, true/*a source type*/)) { // accept type checks for existence + if (acceptType(type)) { // accept type checks for existence requestor.acceptType(type); break; // since an exact match was requested, no other matching type can exist } @@ -1825,7 +1787,7 @@ public class NameLookup implements SuffixConstants { // continue; IType type = ((IJavaScriptUnit) cu).getType(topLevelTypeName); type = getMemberType(type, name, firstDot); - if (acceptType(type, acceptFlags, true/*a source type*/)) { // accept type checks for existence + if (acceptType(type)) { // accept type checks for existence acceptedCUs.add(cu); requestor.acceptType(type); break; // since an exact match was requested, no other matching type can exist @@ -1939,7 +1901,7 @@ public class NameLookup implements SuffixConstants { String subPrefix = prefix.substring(firstDot + 1, prefix.length()); return seekTypesInType(subPrefix, subPrefix.indexOf('.'), memberType, requestor, acceptFlags); } else { - if (acceptType(memberType, acceptFlags, true/*a source type*/)) { + if (acceptType(memberType)) { requestor.acceptMemberType(memberType); return true; } @@ -1952,7 +1914,7 @@ public class NameLookup implements SuffixConstants { if (!topLevelType.getElementName().toLowerCase().startsWith(prefix)) return false; if (firstDot == -1) { - if (acceptType(topLevelType, acceptFlags, true/*a source type*/)) { + if (acceptType(topLevelType)) { requestor.acceptType(topLevelType); return true; } @@ -1981,7 +1943,7 @@ public class NameLookup implements SuffixConstants { Object object = typeMap.get(topLevelTypeName); if (object instanceof IType) { IType type = getMemberType((IType) object, name, firstDot); - if (acceptType(type, acceptFlags, true/*a source type*/)) { + if (acceptType(type)) { requestor.acceptType(type); return true; // don't continue with compilation unit } @@ -1992,7 +1954,7 @@ public class NameLookup implements SuffixConstants { if (requestor.isCanceled()) return false; IType type = getMemberType(topLevelTypes[i], name, firstDot); - if (acceptType(type, acceptFlags, true/*a source type*/)) { + if (acceptType(type)) { requestor.acceptType(type); return true; // return the first one } diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SearchableEnvironment.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SearchableEnvironment.java index d9d5effb..8db5df3e 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SearchableEnvironment.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SearchableEnvironment.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -106,24 +106,6 @@ public class SearchableEnvironment implements INameEnvironment, .getJavaModelManager() .getWorkingCopies(owner, true/* add primary WCs */)); } - private static int convertSearchFilterToModelFilter(int searchFilter) { - switch (searchFilter) { - case IJavaScriptSearchConstants.CLASS: - return NameLookup.ACCEPT_CLASSES; - case IJavaScriptSearchConstants.INTERFACE: - return NameLookup.ACCEPT_INTERFACES; - case IJavaScriptSearchConstants.ENUM: - return NameLookup.ACCEPT_ENUMS; - case IJavaScriptSearchConstants.ANNOTATION_TYPE: - return NameLookup.ACCEPT_ANNOTATIONS; - case IJavaScriptSearchConstants.CLASS_AND_ENUM: - return NameLookup.ACCEPT_CLASSES | NameLookup.ACCEPT_ENUMS; - case IJavaScriptSearchConstants.CLASS_AND_INTERFACE: - return NameLookup.ACCEPT_CLASSES | NameLookup.ACCEPT_INTERFACES; - default: - return NameLookup.ACCEPT_ALL; - } - } /** * Returns the given type in the the given package if it exists, otherwise @@ -133,7 +115,7 @@ public class SearchableEnvironment implements INameEnvironment, if (packageName == null) packageName = IPackageFragment.DEFAULT_PACKAGE_NAME; NameLookup.Answer answer = this.nameLookup.findType(typeName, - packageName, false/* exact match */, NameLookup.ACCEPT_ALL, + packageName, false/* exact match */, NameLookup.ACCEPT_CLASSES, this.checkAccessRestrictions); if (answer != null) { // construct name env answer @@ -212,7 +194,7 @@ public class SearchableEnvironment implements INameEnvironment, packageName, type, false/* exact match */, - NameLookup.ACCEPT_ALL, + NameLookup.ACCEPT_CLASSES, this.checkAccessRestrictions, returnMultiple, excludePath); if (answer != null && answer.element!=null) { if (answer.element instanceof IJavaScriptElement) @@ -279,7 +261,7 @@ public class SearchableEnvironment implements INameEnvironment, findExactTypes( new String(name), storage, - convertSearchFilterToModelFilter(searchFor)); + NameLookup.ACCEPT_CLASSES); return; } excludePath = ((IJavaScriptElement) this.unitToSkip).getPath().toString(); @@ -338,13 +320,13 @@ public class SearchableEnvironment implements INameEnvironment, findExactTypes( new String(name), storage, - convertSearchFilterToModelFilter(searchFor)); + NameLookup.ACCEPT_CLASSES); } } catch (JavaScriptModelException e) { findExactTypes( new String(name), storage, - convertSearchFilterToModelFilter(searchFor)); + NameLookup.ACCEPT_CLASSES); } } @@ -434,7 +416,7 @@ public class SearchableEnvironment implements INameEnvironment, if (!(this.unitToSkip instanceof IJavaScriptElement)) { // revert to model investigation findTypes(new String(prefix), storage, - convertSearchFilterToModelFilter(searchFor)); + NameLookup.ACCEPT_CLASSES); return; } excludePath = ((IJavaScriptElement) this.unitToSkip).getPath() @@ -520,10 +502,10 @@ public class SearchableEnvironment implements INameEnvironment, typeRequestor, CANCEL_IF_NOT_READY_TO_SEARCH, progressMonitor); } catch (OperationCanceledException e) { - findTypes(new String(prefix), storage, convertSearchFilterToModelFilter(searchFor)); + findTypes(new String(prefix), storage, NameLookup.ACCEPT_CLASSES); } } catch (JavaScriptModelException e) { - findTypes(new String(prefix), storage, NameLookup.ACCEPT_ALL); + findTypes(new String(prefix), storage, NameLookup.ACCEPT_CLASSES); } } @@ -558,7 +540,7 @@ public class SearchableEnvironment implements INameEnvironment, if (!(this.unitToSkip instanceof IJavaScriptElement)) { // revert to model investigation findBindings(new String(prefix),bindingType, storage, - NameLookup.ACCEPT_ALL); + NameLookup.ACCEPT_CLASSES); return; } excludePath = ((IJavaScriptElement) this.unitToSkip).getPath() @@ -668,10 +650,10 @@ public class SearchableEnvironment implements INameEnvironment, true, progressMonitor); } catch (OperationCanceledException e) { - findBindings(new String(prefix),bindingType, storage, NameLookup.ACCEPT_ALL); + findBindings(new String(prefix),bindingType, storage, NameLookup.ACCEPT_CLASSES); } } catch (JavaScriptModelException e) { - findTypes(new String(prefix), storage, NameLookup.ACCEPT_ALL); + findTypes(new String(prefix), storage, NameLookup.ACCEPT_CLASSES); } } diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SelectionRequestor.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SelectionRequestor.java index 6ab09d75..62903cfd 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SelectionRequestor.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SelectionRequestor.java @@ -209,7 +209,7 @@ public void acceptError(CategorizedProblem error) { public void acceptField(char[] declaringTypePackageName, char[] fileName, char[] declaringTypeName, char[] name, boolean isDeclaration, char[] uniqueKey, int start, int end) { if(isDeclaration) { IType type= resolveTypeByLocation(declaringTypePackageName, declaringTypeName, - NameLookup.ACCEPT_ALL, + NameLookup.ACCEPT_CLASSES, start, end); if(type != null) { try { @@ -234,7 +234,7 @@ public void acceptField(char[] declaringTypePackageName, char[] fileName, char[] } } } else { - IType type= resolveType(declaringTypePackageName, fileName, declaringTypeName, NameLookup.ACCEPT_ALL); + IType type= resolveType(declaringTypePackageName, fileName, declaringTypeName, NameLookup.ACCEPT_CLASSES); if (type != null) { IField field= type.getField(new String(name)); if (field.exists()) { @@ -429,7 +429,7 @@ public void acceptMethod( if(isDeclaration) { IType type = resolveTypeByLocation(declaringTypePackageName, declaringTypeName, - NameLookup.ACCEPT_ALL, + NameLookup.ACCEPT_CLASSES, start, end); // if(type != null) { @@ -437,7 +437,7 @@ public void acceptMethod( // } } else { IJavaScriptElement parent = (!isFileName) ? - resolveType(declaringTypePackageName, fileName,declaringTypeName,NameLookup.ACCEPT_ALL) + resolveType(declaringTypePackageName, fileName,declaringTypeName,NameLookup.ACCEPT_CLASSES) : resolveCompilationUnit(declaringTypePackageName, declaringTypeName); // fix for 1FWFT6Q // if (type != null) { @@ -643,11 +643,11 @@ public void acceptTypeParameter(char[] declaringTypePackageName, char[] fileName IType type; if(isDeclaration) { type = resolveTypeByLocation(declaringTypePackageName, declaringTypeName, - NameLookup.ACCEPT_ALL, + NameLookup.ACCEPT_CLASSES, start, end); } else { type = resolveType(declaringTypePackageName, fileName, declaringTypeName, - NameLookup.ACCEPT_ALL); + NameLookup.ACCEPT_CLASSES); } if(type != null) { @@ -661,7 +661,7 @@ public void acceptTypeParameter(char[] declaringTypePackageName, char[] fileName } public void acceptMethodTypeParameter(char[] declaringTypePackageName, char[] fileName, char[] declaringTypeName, char[] selector,int selectorStart, int selectorEnd, char[] typeParameterName, boolean isDeclaration, int start, int end) { IType type = resolveTypeByLocation(declaringTypePackageName, declaringTypeName, - NameLookup.ACCEPT_ALL, + NameLookup.ACCEPT_CLASSES, selectorStart, selectorEnd); if(type != null) { diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SourceType.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SourceType.java index 7f2455e3..50b00db2 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SourceType.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SourceType.java @@ -412,32 +412,6 @@ public String getSuperclassTypeSignature() throws JavaScriptModelException { return new String(Signature.createTypeSignature(superclassName, false)); } -/** - * @see IType - */ -public String[] getSuperInterfaceNames() throws JavaScriptModelException { - SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo(); - char[][] names= info.getInterfaceNames(); - return CharOperation.toStrings(names); -} - -/** - * @see IType#getSuperInterfaceTypeSignatures() - * @since 3.0 - */ -public String[] getSuperInterfaceTypeSignatures() throws JavaScriptModelException { - SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo(); - char[][] names= info.getInterfaceNames(); - if (names == null) { - return CharOperation.NO_STRINGS; - } - String[] strings= new String[names.length]; - for (int i= 0; i < names.length; i++) { - strings[i]= new String(Signature.createTypeSignature(names[i], false)); - } - return strings; -} - /** * @see IType */ diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyBinaryType.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyBinaryType.java index e56a9707..75ebedb7 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyBinaryType.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyBinaryType.java @@ -26,7 +26,6 @@ public class HierarchyBinaryType implements IBinaryType { private char[] name; private char[] enclosingTypeName; private char[] superclass; - private char[][] superInterfaces = NoInterface; private char[][] typeParameterSignatures; private char[] genericSignature; @@ -78,24 +77,12 @@ public char[] getGenericSignature() { buffer.append(Signature.createTypeSignature("java.lang.Object", true/*resolved*/)); //$NON-NLS-1$ else buffer.append(Signature.createTypeSignature(this.superclass, true/*resolved*/)); - if (this.superInterfaces != null) - for (int i = 0, length = this.superInterfaces.length; i < length; i++) - buffer.append(Signature.createTypeSignature(this.superInterfaces[i], true/*resolved*/)); this.genericSignature = buffer.toString().toCharArray(); CharOperation.replace(this.genericSignature, '.', '/'); } return this.genericSignature; } -/** - * Answer the resolved names of the receiver's interfaces in the - * class file format as specified in section 4.2 of the Java 2 VM spec - * or null if the array is empty. - * - * For example, java.lang.String is java/lang/String. - */ -public char[][] getInterfaceNames() { - return this.superInterfaces; -} + /** * Answer the receiver's nested types or null if the array is empty. * @@ -178,16 +165,6 @@ public void recordSuperType(char[] superTypeName, char[] superQualification, cha char[] encodedName = CharOperation.concat(superQualification, superTypeName, '/'); CharOperation.replace(encodedName, '.', '/'); this.superclass = encodedName; - } else { - char[] encodedName = CharOperation.concat(superQualification, superTypeName, '/'); - CharOperation.replace(encodedName, '.', '/'); - if (this.superInterfaces == NoInterface){ - this.superInterfaces = new char[][] { encodedName }; - } else { - int length = this.superInterfaces.length; - System.arraycopy(this.superInterfaces, 0, this.superInterfaces = new char[length+1][], 0, length); - this.superInterfaces[length] = encodedName; - } } } public String toString() { @@ -207,16 +184,6 @@ public String toString() { buffer.append("\n extends "); //$NON-NLS-1$ buffer.append(this.superclass); } - int length; - if (this.superInterfaces != null && (length = this.superInterfaces.length) != 0) { - buffer.append("\n implements "); //$NON-NLS-1$ - for (int i = 0; i < length; i++) { - buffer.append(this.superInterfaces[i]); - if (i != length - 1) { - buffer.append(", "); //$NON-NLS-1$ - } - } - } return buffer.toString(); } diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyBuilder.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyBuilder.java index 842d5baa..ccc995d6 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyBuilder.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyBuilder.java @@ -131,15 +131,14 @@ public abstract class HierarchyBuilder { } } /** - * Connect the supplied type to its superclass & superinterfaces. - * The superclass & superinterfaces are the identical binary or source types as + * Connect the supplied type to its superclass. + * The superclass is the identical binary or source types as * supplied by the name environment. */ public void connect( IGenericType type, IType typeHandle, - IType superclassHandle, - IType[] superinterfaceHandles) { + IType superclassHandle) { /* * Temporary workaround for 1G2O5WK: ITPJCORE:WINNT - NullPointerException when selecting "Show in Type Hierarchy" for a inner class @@ -154,17 +153,6 @@ public abstract class HierarchyBuilder { + (superclassHandle == null ? "" //$NON-NLS-1$ : ((JavaElement) superclassHandle).toStringWithAncestors())); - System.out.print(" and superinterfaces:"); //$NON-NLS-1$ - if (superinterfaceHandles == null || superinterfaceHandles.length == 0) { - System.out.println(" "); //$NON-NLS-1$ - } else { - System.out.println(); - for (int i = 0, length = superinterfaceHandles.length; i < length; i++) { - if (superinterfaceHandles[i] == null) continue; - System.out.println( - " " + ((JavaElement) superinterfaceHandles[i]).toStringWithAncestors()); //$NON-NLS-1$ - } - } } // now do the caching switch (TypeDeclaration.kind(type.getModifiers())) { @@ -176,10 +164,6 @@ public abstract class HierarchyBuilder { } break; } - if (superinterfaceHandles == null) { - superinterfaceHandles = TypeHierarchy.NO_TYPE; - } - this.hierarchy.cacheSuperInterfaces(typeHandle, superinterfaceHandles); // record flags this.hierarchy.cacheFlags(typeHandle, type.getModifiers()); @@ -224,23 +208,13 @@ public abstract class HierarchyBuilder { * Looks up and returns a handle for the given binary info. */ protected IType lookupBinaryHandle(ISourceType typeInfo) { - int flag; String qualifiedName; - switch (TypeDeclaration.kind(typeInfo.getModifiers())) { - case TypeDeclaration.CLASS_DECL : - flag = NameLookup.ACCEPT_CLASSES; - break; - default: - //case IGenericType.ANNOTATION : - flag = NameLookup.ACCEPT_ANNOTATIONS; - break; - } char[] bName = typeInfo.getName(); qualifiedName = new String(ClassFile.translatedName(bName)); if (qualifiedName.equals(this.focusQualifiedName)) return getType(); NameLookup.Answer answer = this.nameLookup.findType(qualifiedName, false, - flag, + NameLookup.ACCEPT_CLASSES, true/* consider secondary types */, false/* do NOT wait for indexes */, false/*don't check restrictions*/, diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyResolver.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyResolver.java index 5f39f04c..2bc8f111 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyResolver.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyResolver.java @@ -253,91 +253,7 @@ private IType findSuperClass(IGenericType type, ReferenceBinding typeBinding) { return null; } -/* - * Returns the handles of the super interfaces of the given type. - * Adds the simple name to the hierarchy missing types if an interface is not found (but don't put null in the returned array) - */ -//private IType[] findSuperInterfaces(IGenericType type, ReferenceBinding typeBinding) { -// char[][] superInterfaceNames; -// char separator; -// if (type instanceof IBinaryType) { -// superInterfaceNames = ((IBinaryType)type).getInterfaceNames(); -// separator = '/'; -// } else if (type instanceof ISourceType) { -// ISourceType sourceType = (ISourceType)type; -// if (sourceType.getName().length == 0) { // if anonymous type -// if (typeBinding.superInterfaces() != null && typeBinding.superInterfaces().length > 0) { -// superInterfaceNames = new char[][] {sourceType.getSuperclassName()}; -// } else { -// superInterfaceNames = sourceType.getInterfaceNames(); -// } -// } else { -// if (TypeDeclaration.kind(sourceType.getModifiers()) == TypeDeclaration.ANNOTATION_TYPE_DECL) -// superInterfaceNames = new char[][] {TypeConstants.CharArray_JAVA_LANG_ANNOTATION_ANNOTATION}; -// else -// superInterfaceNames = sourceType.getInterfaceNames(); -// } -// separator = '.'; -// } else if (type instanceof HierarchyType) { -// HierarchyType hierarchyType = (HierarchyType)type; -// if (hierarchyType.name.length == 0) { // if anonymous type -// if (typeBinding.superInterfaces() != null && typeBinding.superInterfaces().length > 0) { -// superInterfaceNames = new char[][] {hierarchyType.superclassName}; -// } else { -// superInterfaceNames = hierarchyType.superInterfaceNames; -// } -// } else { -// superInterfaceNames = hierarchyType.superInterfaceNames; -// } -// separator = '.'; -// } else{ -// return null; -// } -// -// ReferenceBinding[] interfaceBindings = typeBinding.superInterfaces(); -// int bindingIndex = 0; -// int bindingLength = interfaceBindings == null ? 0 : interfaceBindings.length; -// int length = superInterfaceNames == null ? 0 : superInterfaceNames.length; -// IType[] superinterfaces = new IType[length]; -// int index = 0; -// next : for (int i = 0; i < length; i++) { -// char[] superInterfaceName = superInterfaceNames[i]; -// int end = superInterfaceName.length; -// -// // find the end of simple name -// int genericStart = CharOperation.indexOf(Signature.C_GENERIC_START, superInterfaceName); -// if (genericStart != -1) end = genericStart; -// -// // find the start of simple name -// int lastSeparator = CharOperation.lastIndexOf(separator, superInterfaceName, 0, end); -// int start = lastSeparator + 1; -// -// // case of binary inner type -> take the last part -// int lastDollar = CharOperation.lastIndexOf('$', superInterfaceName, start); -// if (lastDollar != -1) start = lastDollar + 1; -// -// char[] simpleName = CharOperation.subarray(superInterfaceName, start, end); -// -// if (bindingIndex < bindingLength) { -// ReferenceBinding interfaceBinding = (ReferenceBinding) interfaceBindings[bindingIndex].erasure(); -// -// // ensure that the binding corresponds to the interface defined by the user -// if (CharOperation.equals(simpleName, interfaceBinding.sourceName)) { -// bindingIndex++; -// for (int t = this.typeIndex; t >= 0; t--) { -// if (this.typeBindings[t] == interfaceBinding) { -// superinterfaces[index++] = this.builder.getHandle(this.typeModels[t], interfaceBinding); -// continue next; -// } -// } -// } -// } -// this.builder.hierarchy.missingTypes.add(new String(simpleName)); -// } -// if (index != length) -// System.arraycopy(superinterfaces, 0, superinterfaces = new IType[index], 0, index); -// return superinterfaces; -//} + private void fixSupertypeBindings() { for (int current = this.typeIndex; current >= 0; current--) { ReferenceBinding typeBinding = this.typeBindings[current]; @@ -405,15 +321,11 @@ private void remember(IType type, ReferenceBinding typeBinding) { superclassName = typeName == null ? null : typeName[typeName.length-1]; } - // simple super interface names - char[][] superInterfaceNames = null; - HierarchyType hierarchyType = new HierarchyType( type, typeDeclaration.name, typeDeclaration.binding.modifiers, - superclassName, - superInterfaceNames); + superclassName); remember(hierarchyType, typeDeclaration.binding); } @@ -446,25 +358,11 @@ private void rememberInferredType(InferredType inferredType, IType type, Referen // superclassName = typeName == null ? null : typeName[typeName.length-1]; // } -// // simple super interface names - char[][] superInterfaceNames = null; -// TypeReference[] superInterfaces = typeDeclaration.superInterfaces; -// if (superInterfaces != null) { -// int length = superInterfaces.length; -// superInterfaceNames = new char[length][]; -// for (int i = 0; i < length; i++) { -// TypeReference superInterface = superInterfaces[i]; -// char[][] typeName = superInterface.getTypeName(); -// superInterfaceNames[i] = typeName[typeName.length-1]; -// } -// } -// HierarchyType hierarchyType = new HierarchyType( type, inferredType.getName(), 0,//typeDeclaration.binding.modifiers, - superclassName, - superInterfaceNames); + superclassName); remember(hierarchyType, inferredType.binding); } @@ -574,15 +472,13 @@ private void reportHierarchy(IType focus, CompilationUnitDeclaration parsedUnit, } IType superclass = findSuperClass(suppliedType, typeBinding); - - IType[] superinterfaces = new IType[0];// findSuperInterfaces(suppliedType, typeBinding); - this.builder.connect(suppliedType, this.builder.getHandle(suppliedType, typeBinding), superclass, superinterfaces); + this.builder.connect(suppliedType, this.builder.getHandle(suppliedType, typeBinding), superclass); } // add java.lang.Object only if the super class is not missing if (!this.hasMissingSuperClass && objectIndex > -1) { IGenericType objectType = this.typeModels[objectIndex]; - this.builder.connect(objectType, this.builder.getHandle(objectType, this.typeBindings[objectIndex]), null, null); + this.builder.connect(objectType, this.builder.getHandle(objectType, this.typeBindings[objectIndex]), null); } } @@ -600,7 +496,7 @@ private void reset(){ /** * Resolve the supertypes for the supplied source type. * Inform the requestor of the resolved supertypes using: - * connect(ISourceType suppliedType, IGenericType superclass, IGenericType[] superinterfaces) + * connect(ISourceType suppliedType, IGenericType superclass) * @param suppliedType */ public void resolve(IGenericType suppliedType) { @@ -608,7 +504,7 @@ public void resolve(IGenericType suppliedType) { if (suppliedType.isBinaryType()) { ReferenceBinding binaryTypeBinding = this.lookupEnvironment.cacheBinaryType((ISourceType) suppliedType, false/*don't need field and method (bug 125067)*/, null /*no access restriction*/); remember(suppliedType, binaryTypeBinding); - // We still need to add superclasses and superinterfaces bindings (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53095) + // We still need to add superclasses bindings (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53095) int startIndex = this.typeIndex; for (int i = startIndex; i <= this.typeIndex; i++) { IGenericType igType = this.typeModels[i]; @@ -641,7 +537,7 @@ public void resolve(IGenericType suppliedType) { * Resolve the supertypes for the types contained in the given openables (ICompilationUnits and/or IClassFiles). * Inform the requestor of the resolved supertypes for each * supplied source type using: - * connect(ISourceType suppliedType, IGenericType superclass, IGenericType[] superinterfaces) + * connect(ISourceType suppliedType, IGenericType superclass) * * Also inform the requestor of the supertypes of each * additional requested super type which is also a source type @@ -903,7 +799,7 @@ public boolean subOrSuperOfFocus(ReferenceBinding typeBinding) { if (this.subTypeOfType(this.focusType, typeBinding)) return true; if (!this.superTypesOnly && this.subTypeOfType(typeBinding, this.focusType)) return true; } catch (AbortCompilation e) { - // unresolved superclass/superinterface -> ignore + // unresolved superclass -> ignore } return false; } diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyType.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyType.java index 02a9cb35..93b2c1e2 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyType.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/HierarchyType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,20 +24,17 @@ public class HierarchyType implements IGenericType { public char[] name; public int modifiers; public char[] superclassName; - public char[][] superInterfaceNames; public HierarchyType( IType typeHandle, char[] name, int modifiers, - char[] superclassName, - char[][] superInterfaceNames) { + char[] superclassName) { this.typeHandle = typeHandle; this.name = name; this.modifiers = modifiers; this.superclassName = superclassName; - this.superInterfaceNames = superInterfaceNames; } /** * @see org.eclipse.wst.jsdt.internal.compiler.env.IDependent#getFileName() diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/RegionBasedTypeHierarchy.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/RegionBasedTypeHierarchy.java index c644cc34..8400ba9a 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/RegionBasedTypeHierarchy.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/RegionBasedTypeHierarchy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -125,7 +125,6 @@ public IJavaScriptProject javaProject() { } public void pruneDeadBranches() { pruneDeadBranches(getRootClasses()); - pruneDeadBranches(getRootInterfaces()); } /* * Returns whether all subtypes of the given type have been pruned. @@ -150,7 +149,7 @@ private void pruneDeadBranches(IType[] types) { * removes its superclass entry and removes the references from its super types. */ protected void removeType(IType type) { - IType[] subtypes = this.getSubtypes(type); + IType[] subtypes = this.getSubclasses(type); this.typeToSubtypes.remove(type); if (subtypes != null) { for (int i= 0; i < subtypes.length; i++) { @@ -162,15 +161,6 @@ protected void removeType(IType type) { TypeVector types = (TypeVector)this.typeToSubtypes.get(superclass); if (types != null) types.remove(type); } - IType[] superinterfaces = (IType[])this.typeToSuperInterfaces.remove(type); - if (superinterfaces != null) { - for (int i = 0, length = superinterfaces.length; i < length; i++) { - IType superinterface = superinterfaces[i]; - TypeVector types = (TypeVector)this.typeToSubtypes.get(superinterface); - if (types != null) types.remove(type); - } - } - this.interfaces.remove(type); } } diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/TypeHierarchy.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/TypeHierarchy.java index 3712c6b7..6b9f87cc 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/TypeHierarchy.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/hierarchy/TypeHierarchy.java @@ -74,7 +74,6 @@ public class TypeHierarchy implements ITypeHierarchy, IElementChangedListener { // type info static final byte CLASS = 0x0000; - static final byte INTERFACE = 0x0001; static final byte COMPUTED_FOR = 0x0002; static final byte ROOT = 0x0004; @@ -100,11 +99,9 @@ public class TypeHierarchy implements ITypeHierarchy, IElementChangedListener { protected IJavaScriptUnit[] workingCopies; protected Map classToSuperclass; - protected Map typeToSuperInterfaces; protected Map typeToSubtypes; protected Map typeFlags; protected TypeVector rootClasses = new TypeVector(); - protected ArrayList interfaces = new ArrayList(10); public ArrayList missingTypes = new ArrayList(4); protected static final IType[] NO_TYPE = new IType[0]; @@ -183,7 +180,7 @@ public TypeHierarchy(IType type, IJavaScriptUnit[] workingCopies, IJavaScriptSea */ protected void initializeRegions() { - IType[] allTypes = getAllTypes(); + IType[] allTypes = getAllClasses(); for (int i = 0; i < allTypes.length; i++) { IType type = allTypes[i]; Openable o = (Openable) ((JavaElement) type).getOpenableParent(); @@ -204,24 +201,7 @@ protected void initializeRegions() { checkCanceled(); } } -/** - * Adds all of the elements in the collection to the list if the - * element is not already in the list. - */ -private void addAllCheckingDuplicates(ArrayList list, IType[] collection) { - for (int i = 0; i < collection.length; i++) { - IType element = collection[i]; - if (!list.contains(element)) { - list.add(element); - } - } -} -/** - * Adds the type to the collection of interfaces. - */ -protected void addInterface(IType type) { - this.interfaces.add(type); -} + /** * Adds the type to the collection of root classes * if the classes is not already present in the collection. @@ -286,19 +266,7 @@ protected void cacheSuperclass(IType type, IType superclass) { addSubtype(superclass, type); } } -/** - * Caches all of the superinterfaces that are specified for the - * type. - */ -protected void cacheSuperInterfaces(IType type, IType[] superinterfaces) { - this.typeToSuperInterfaces.put(type, superinterfaces); - for (int i = 0; i < superinterfaces.length; i++) { - IType superinterface = superinterfaces[i]; - if (superinterface != null) { - addSubtype(superinterface, type); - } - } -} + /** * Checks with the progress monitor to see whether the creation of the type hierarchy * should be canceled. Should be regularly called @@ -350,9 +318,6 @@ public boolean contains(IType type) { // root classes if (this.rootClasses.contains(type)) return true; - // interfaces - if (this.interfaces.contains(type)) return true; - return false; } /** @@ -424,14 +389,7 @@ public IType[] getAllClasses() { } return classes.elements(); } -/** - * @see ITypeHierarchy - */ -public IType[] getAllInterfaces() { - IType[] collection= new IType[this.interfaces.size()]; - this.interfaces.toArray(collection); - return collection; -} + /** * @see ITypeHierarchy */ @@ -472,72 +430,6 @@ public IType[] getAllSuperclasses(IType type) { } return supers.elements(); } -/** - * @see ITypeHierarchy - */ -public IType[] getAllSuperInterfaces(IType type) { - ArrayList supers = new ArrayList(); - if (this.typeToSuperInterfaces.get(type) == null) { - return NO_TYPE; - } - getAllSuperInterfaces0(type, supers); - IType[] superinterfaces = new IType[supers.size()]; - supers.toArray(superinterfaces); - return superinterfaces; -} -private void getAllSuperInterfaces0(IType type, ArrayList supers) { - IType[] superinterfaces = (IType[]) this.typeToSuperInterfaces.get(type); - if (superinterfaces != null && superinterfaces.length != 0) { - addAllCheckingDuplicates(supers, superinterfaces); - for (int i = 0; i < superinterfaces.length; i++) { - getAllSuperInterfaces0(superinterfaces[i], supers); - } - } - IType superclass = (IType) this.classToSuperclass.get(type); - if (superclass != null) { - getAllSuperInterfaces0(superclass, supers); - } -} -/** - * @see ITypeHierarchy - */ -public IType[] getAllSupertypes(IType type) { - ArrayList supers = new ArrayList(); - if (this.typeToSuperInterfaces.get(type) == null) { - return NO_TYPE; - } - getAllSupertypes0(type, supers); - IType[] supertypes = new IType[supers.size()]; - supers.toArray(supertypes); - return supertypes; -} -private void getAllSupertypes0(IType type, ArrayList supers) { - IType[] superinterfaces = (IType[]) this.typeToSuperInterfaces.get(type); - if (superinterfaces != null && superinterfaces.length != 0) { - addAllCheckingDuplicates(supers, superinterfaces); - for (int i = 0; i < superinterfaces.length; i++) { - getAllSuperInterfaces0(superinterfaces[i], supers); - } - } - IType superclass = (IType) this.classToSuperclass.get(type); - if (superclass != null) { - supers.add(superclass); - getAllSupertypes0(superclass, supers); - } -} -/** - * @see ITypeHierarchy - */ -public IType[] getAllTypes() { - IType[] classes = getAllClasses(); - int classesLength = classes.length; - IType[] allInterfaces = getAllInterfaces(); - int interfacesLength = allInterfaces.length; - IType[] all = new IType[classesLength + interfacesLength]; - System.arraycopy(classes, 0, all, 0, classesLength); - System.arraycopy(allInterfaces, 0, all, classesLength, interfacesLength); - return all; -} /** * @see ITypeHierarchy#getCachedFlags(IType) @@ -550,43 +442,13 @@ public int getCachedFlags(IType type) { return -1; } -/** - * @see ITypeHierarchy - */ -public IType[] getExtendingInterfaces(IType type) { - return NO_TYPE; -} -/** - * @see ITypeHierarchy - */ -public IType[] getImplementingClasses(IType type) { - return NO_TYPE; -} /** * @see ITypeHierarchy */ public IType[] getRootClasses() { return this.rootClasses.elements(); } -/** - * @see ITypeHierarchy - */ -public IType[] getRootInterfaces() { - IType[] allInterfaces = getAllInterfaces(); - IType[] roots = new IType[allInterfaces.length]; - int rootNumber = 0; - for (int i = 0; i < allInterfaces.length; i++) { - IType[] superInterfaces = getSuperInterfaces(allInterfaces[i]); - if (superInterfaces == null || superInterfaces.length == 0) { - roots[rootNumber++] = allInterfaces[i]; - } - } - IType[] result = new IType[rootNumber]; - if (result.length > 0) { - System.arraycopy(roots, 0, result, 0, rootNumber); - } - return result; -} + /** * @see ITypeHierarchy */ @@ -597,12 +459,7 @@ public IType[] getSubclasses(IType type) { else return vector.elements(); } -/** - * @see ITypeHierarchy - */ -public IType[] getSubtypes(IType type) { - return getSubtypesForType(type); -} + /** * Returns an array of subtypes for the given type - will never return null. */ @@ -619,29 +476,7 @@ private IType[] getSubtypesForType(IType type) { public IType getSuperclass(IType type) { return (IType) this.classToSuperclass.get(type); } -/** - * @see ITypeHierarchy - */ -public IType[] getSuperInterfaces(IType type) { - IType[] types = (IType[]) this.typeToSuperInterfaces.get(type); - if (types == null) { - return NO_TYPE; - } - return types; -} -/** - * @see ITypeHierarchy - */ -public IType[] getSupertypes(IType type) { - IType superclass = getSuperclass(type); - if (superclass == null) { - return getSuperInterfaces(type); - } else { - TypeVector superTypes = new TypeVector(getSuperInterfaces(type)); - superTypes.add(superclass); - return superTypes.elements(); - } -} + /** * @see ITypeHierarchy */ @@ -691,7 +526,7 @@ private boolean hasSubtypeNamed(String simpleName) { if (this.focusType != null && this.focusType.getElementName().equals(simpleName)) { return true; } - IType[] types = this.focusType == null ? getAllTypes() : getAllSubtypes(this.focusType); + IType[] types = this.focusType == null ? getAllClasses() : getAllSubtypes(this.focusType); for (int i = 0, length = types.length; i < length; i++) { if (types[i].getElementName().equals(simpleName)) { return true; @@ -704,7 +539,7 @@ private boolean hasSubtypeNamed(String simpleName) { * Returns whether one of the types in this hierarchy has the given simple name. */ private boolean hasTypeNamed(String simpleName) { - IType[] types = this.getAllTypes(); + IType[] types = this.getAllClasses(); for (int i = 0, length = types.length; i < length; i++) { if (types[i].getElementName().equals(simpleName)) { return true; @@ -743,11 +578,9 @@ protected void initialize(int size) { } int smallSize = (size / 2); this.classToSuperclass = new HashMap(size); - this.interfaces = new ArrayList(smallSize); this.missingTypes = new ArrayList(smallSize); this.rootClasses = new TypeVector(); this.typeToSubtypes = new HashMap(smallSize); - this.typeToSuperInterfaces = new HashMap(smallSize); this.typeFlags = new HashMap(smallSize); this.projectRegion = new Region(); @@ -1074,9 +907,6 @@ public static ITypeHierarchy load(IType type, InputStream input, WorkingCopyOwne // read info byte info = (byte)input.read(); - if((info & INTERFACE) != 0) { - typeHierarchy.addInterface(element); - } if((info & COMPUTED_FOR) != 0) { if(!element.equals(type)) { throw new JavaScriptModelException(new JavaModelStatus(IStatus.ERROR)); @@ -1103,36 +933,6 @@ public static ITypeHierarchy load(IType type, InputStream input, WorkingCopyOwne types[superClass]); } - // read super interface - while((b = (byte)input.read()) != SEPARATOR1 && b != -1) { - bytes = readUntil(input, SEPARATOR3, 1); - bytes[0] = b; - int subClass = new Integer(new String(bytes)).intValue(); - - // read super interface - bytes = readUntil(input, SEPARATOR1); - IType[] superInterfaces = new IType[(bytes.length / 2) + 1]; - int interfaceCount = 0; - - int j = 0; - byte[] b2; - for (int i = 0; i < bytes.length; i++) { - if(bytes[i] == SEPARATOR2){ - b2 = new byte[i - j]; - System.arraycopy(bytes, j, b2, 0, i - j); - j = i + 1; - superInterfaces[interfaceCount++] = types[new Integer(new String(b2)).intValue()]; - } - } - b2 = new byte[bytes.length - j]; - System.arraycopy(bytes, j, b2, 0, bytes.length - j); - superInterfaces[interfaceCount++] = types[new Integer(new String(b2)).intValue()]; - System.arraycopy(superInterfaces, 0, superInterfaces = new IType[interfaceCount], 0, interfaceCount); - - typeHierarchy.cacheSuperInterfaces( - types[subClass], - superInterfaces); - } if(b == -1) { throw new JavaScriptModelException(new JavaModelStatus(IStatus.ERROR)); } @@ -1254,27 +1054,6 @@ public void store(OutputStream output, IProgressMonitor monitor) throws JavaScri hashtable2.put(index, superClass); } } - types = this.typeToSuperInterfaces.entrySet().toArray(); - for (int i = 0; i < types.length; i++) { - Map.Entry entry = (Map.Entry) types[i]; - Object t = entry.getKey(); - if(hashtable.get(t) == null) { - Integer index = new Integer(count++); - hashtable.put(t, index); - hashtable2.put(index, t); - } - Object[] sp = (Object[]) entry.getValue(); - if(sp != null) { - for (int j = 0; j < sp.length; j++) { - Object superInterface = sp[j]; - if(sp[j] != null && hashtable.get(superInterface) == null) { - Integer index = new Integer(count++); - hashtable.put(superInterface, index); - hashtable2.put(index, superInterface); - } - } - } - } // save version of the hierarchy format output.write(VERSION); @@ -1314,9 +1093,6 @@ public void store(OutputStream output, IProgressMonitor monitor) throws JavaScri if(this.focusType != null && this.focusType.equals(t)) { info |= COMPUTED_FOR; } - if(this.interfaces.contains(t)) { - info |= INTERFACE; - } if(this.rootClasses.contains(t)) { info |= ROOT; } @@ -1337,25 +1113,6 @@ public void store(OutputStream output, IProgressMonitor monitor) throws JavaScri output.write(SEPARATOR1); } output.write(SEPARATOR1); - - // save superinterfaces - types = this.typeToSuperInterfaces.entrySet().toArray(); - for (int i = 0; i < types.length; i++) { - Map.Entry entry = (Map.Entry) types[i]; - IJavaScriptElement key = (IJavaScriptElement) entry.getKey(); - IJavaScriptElement[] values = (IJavaScriptElement[]) entry.getValue(); - - if(values.length > 0) { - output.write(((Integer)hashtable.get(key)).toString().getBytes()); - output.write(SEPARATOR3); - for (int j = 0; j < values.length; j++) { - IJavaScriptElement value = values[j]; - if(j != 0) output.write(SEPARATOR2); - output.write(((Integer)hashtable.get(value)).toString().getBytes()); - } - output.write(SEPARATOR1); - } - } output.write(SEPARATOR1); } catch(IOException e) { throw new JavaScriptModelException(e, IJavaScriptModelStatusConstants.IO_EXCEPTION); @@ -1432,7 +1189,7 @@ public String toString() { * If ascendant, shows the super types, otherwise show the sub types. */ private void toString(StringBuffer buffer, IType type, int indent, boolean ascendant) { - IType[] types= ascendant ? getSupertypes(type) : getSubtypes(type); + IType[] types= ascendant ? new IType[]{getSuperclass(type)} : getSubclasses(type); IJavaScriptElement[] sortedTypes = Util.sortCopy(types); for (int i= 0; i < sortedTypes.length; i++) { for (int j= 0; j < indent; j++) { diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/BasicSearchEngine.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/BasicSearchEngine.java index 47b4c5d6..97e47f9b 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/BasicSearchEngine.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/BasicSearchEngine.java @@ -305,9 +305,6 @@ public class BasicSearchEngine { case SearchPattern.R_EQUIVALENT_MATCH: buffer.append("R_EQUIVALENT_MATCH"); //$NON-NLS-1$ break; - case SearchPattern.R_ERASURE_MATCH: - buffer.append("R_ERASURE_MATCH"); //$NON-NLS-1$ - break; case SearchPattern.R_FULL_MATCH: buffer.append("R_FULL_MATCH"); //$NON-NLS-1$ break; @@ -344,18 +341,6 @@ public class BasicSearchEngine { return ("FIELD"); //$NON-NLS-1$ case IJavaScriptSearchConstants.CLASS: return ("CLASS"); //$NON-NLS-1$ - case IJavaScriptSearchConstants.INTERFACE: - return ("INTERFACE"); //$NON-NLS-1$ - case IJavaScriptSearchConstants.ENUM: - return ("ENUM"); //$NON-NLS-1$ - case IJavaScriptSearchConstants.ANNOTATION_TYPE: - return ("ANNOTATION_TYPE"); //$NON-NLS-1$ - case IJavaScriptSearchConstants.CLASS_AND_ENUM: - return ("CLASS_AND_ENUM"); //$NON-NLS-1$ - case IJavaScriptSearchConstants.CLASS_AND_INTERFACE: - return ("CLASS_AND_INTERFACE"); //$NON-NLS-1$ - case IJavaScriptSearchConstants.INTERFACE_AND_ANNOTATION: - return ("INTERFACE_AND_ANNOTATION"); //$NON-NLS-1$ case IJavaScriptSearchConstants.VAR: return ("VAR"); //$NON-NLS-1$ case IJavaScriptSearchConstants.FUNCTION: @@ -1076,24 +1061,6 @@ public class BasicSearchEngine { case IJavaScriptSearchConstants.CLASS : typeSuffix = IIndexConstants.CLASS_SUFFIX; break; - case IJavaScriptSearchConstants.CLASS_AND_INTERFACE : - typeSuffix = IIndexConstants.CLASS_AND_INTERFACE_SUFFIX; - break; - case IJavaScriptSearchConstants.CLASS_AND_ENUM : - typeSuffix = IIndexConstants.CLASS_AND_ENUM_SUFFIX; - break; - case IJavaScriptSearchConstants.INTERFACE : - typeSuffix = IIndexConstants.INTERFACE_SUFFIX; - break; - case IJavaScriptSearchConstants.INTERFACE_AND_ANNOTATION : - typeSuffix = IIndexConstants.INTERFACE_AND_ANNOTATION_SUFFIX; - break; - case IJavaScriptSearchConstants.ENUM : - typeSuffix = IIndexConstants.ENUM_SUFFIX; - break; - case IJavaScriptSearchConstants.ANNOTATION_TYPE : - typeSuffix = IIndexConstants.ANNOTATION_TYPE_SUFFIX; - break; default : typeSuffix = IIndexConstants.TYPE_SUFFIX; break; @@ -1331,24 +1298,6 @@ public class BasicSearchEngine { case IJavaScriptSearchConstants.CLASS : typeSuffix = IIndexConstants.CLASS_SUFFIX; break; - case IJavaScriptSearchConstants.CLASS_AND_INTERFACE : - typeSuffix = IIndexConstants.CLASS_AND_INTERFACE_SUFFIX; - break; - case IJavaScriptSearchConstants.CLASS_AND_ENUM : - typeSuffix = IIndexConstants.CLASS_AND_ENUM_SUFFIX; - break; - case IJavaScriptSearchConstants.INTERFACE : - typeSuffix = IIndexConstants.INTERFACE_SUFFIX; - break; - case IJavaScriptSearchConstants.INTERFACE_AND_ANNOTATION : - typeSuffix = IIndexConstants.INTERFACE_AND_ANNOTATION_SUFFIX; - break; - case IJavaScriptSearchConstants.ENUM : - typeSuffix = IIndexConstants.ENUM_SUFFIX; - break; - case IJavaScriptSearchConstants.ANNOTATION_TYPE : - typeSuffix = IIndexConstants.ANNOTATION_TYPE_SUFFIX; - break; default : typeSuffix = IIndexConstants.TYPE_SUFFIX; break; diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/HierarchyScope.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/HierarchyScope.java index 017f4936..3c1e6c00 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/HierarchyScope.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/HierarchyScope.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -114,7 +114,7 @@ public class HierarchyScope extends AbstractSearchScope implements SuffixConstan private void buildResourceVector() { HashMap resources = new HashMap(); HashMap paths = new HashMap(); - this.types = this.hierarchy.getAllTypes(); + this.types = this.hierarchy.getAllClasses(); IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); for (int i = 0; i < this.types.length; i++) { IType type = this.types[i]; diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/indexing/IIndexConstants.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/indexing/IIndexConstants.java index 2cafec9e..0de032d0 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/indexing/IIndexConstants.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/indexing/IIndexConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.wst.jsdt.internal.core.search.indexing; -import org.eclipse.wst.jsdt.core.search.IJavaScriptSearchConstants; public interface IIndexConstants { @@ -35,9 +34,6 @@ public interface IIndexConstants { char ENUM_SUFFIX = 'E'; char ANNOTATION_TYPE_SUFFIX = 'A'; char TYPE_SUFFIX = 0; - char CLASS_AND_ENUM_SUFFIX = IJavaScriptSearchConstants.CLASS_AND_ENUM; - char CLASS_AND_INTERFACE_SUFFIX = IJavaScriptSearchConstants.CLASS_AND_INTERFACE; - char INTERFACE_AND_ANNOTATION_SUFFIX = IJavaScriptSearchConstants.INTERFACE_AND_ANNOTATION; char SEPARATOR= '/'; char SECONDARY_SUFFIX = 'S'; diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/ClassFileMatchLocator.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/ClassFileMatchLocator.java index e74234c8..bbd07003 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/ClassFileMatchLocator.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/ClassFileMatchLocator.java @@ -226,24 +226,12 @@ boolean matchSuperTypeReference(SuperTypeReferencePattern pattern, Object binary if (!(binaryInfo instanceof IBinaryType)) return false; IBinaryType type = (IBinaryType) binaryInfo; - if (pattern.superRefKind != SuperTypeReferencePattern.ONLY_SUPER_INTERFACES) { - char[] vmName = type.getSuperclassName(); - if (vmName != null) { - char[] superclassName = convertClassFileFormat(vmName); - if (checkTypeName(pattern.superSimpleName, pattern.superQualification, superclassName, pattern.isCaseSensitive(), pattern.isCamelCase())) - return true; - } - } - - if (pattern.superRefKind != SuperTypeReferencePattern.ONLY_SUPER_CLASSES) { - char[][] superInterfaces = type.getInterfaceNames(); - if (superInterfaces != null) { - for (int i = 0, max = superInterfaces.length; i < max; i++) { - char[] superInterfaceName = convertClassFileFormat(superInterfaces[i]); - if (checkTypeName(pattern.superSimpleName, pattern.superQualification, superInterfaceName, pattern.isCaseSensitive(), pattern.isCamelCase())) - return true; - } - } + + char[] vmName = type.getSuperclassName(); + if (vmName != null) { + char[] superclassName = convertClassFileFormat(vmName); + if (checkTypeName(pattern.superSimpleName, pattern.superQualification, superclassName, pattern.isCaseSensitive(), pattern.isCamelCase())) + return true; } return false; } diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/ConstructorLocator.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/ConstructorLocator.java index 1dbbf080..5ff32067 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/ConstructorLocator.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/ConstructorLocator.java @@ -14,7 +14,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.wst.jsdt.core.IJavaScriptElement; import org.eclipse.wst.jsdt.core.compiler.CharOperation; import org.eclipse.wst.jsdt.core.search.SearchMatch; -import org.eclipse.wst.jsdt.core.search.SearchPattern; import org.eclipse.wst.jsdt.internal.compiler.ast.ASTNode; import org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.wst.jsdt.internal.compiler.ast.AllocationExpression; @@ -221,13 +220,9 @@ protected void matchReportReference(ASTNode reference, IJavaScriptElement elemen // Create search match match = locator.newMethodReferenceMatch(element, elementBinding, accuracy, -1, -1, true, reference); - if (this.pattern.hasConstructorArguments()) { // binding has no type params, compatible erasure if pattern does - match.setRule(SearchPattern.R_ERASURE_MATCH); - } - // See whether it is necessary to report or not if (match.getRule() == 0) return; // impossible match - boolean report = (this.isErasureMatch && match.isErasure()) || (this.isEquivalentMatch && match.isEquivalent()) || match.isExact(); + boolean report = (this.isEquivalentMatch && match.isEquivalent()) || match.isExact(); if (!report) return; // Report match diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/JavaSearchPattern.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/JavaSearchPattern.java index f94b5a23..8df0250b 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/JavaSearchPattern.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/JavaSearchPattern.java @@ -54,7 +54,7 @@ public class JavaSearchPattern extends SearchPattern implements IIndexConstants /** * Mask used on match rule for generic relevance. */ - public static final int MATCH_COMPATIBILITY_MASK = R_ERASURE_MATCH | R_EQUIVALENT_MATCH | R_FULL_MATCH; + public static final int MATCH_COMPATIBILITY_MASK = R_EQUIVALENT_MATCH | R_FULL_MATCH; // Signatures and arguments for parameterized types search char[][] typeSignatures; @@ -90,10 +90,6 @@ public class JavaSearchPattern extends SearchPattern implements IIndexConstants return this.isCaseSensitive; } - boolean isErasureMatch() { - return (this.matchCompatibility & R_ERASURE_MATCH) != 0; - } - boolean isEquivalentMatch() { return (this.matchCompatibility & R_EQUIVALENT_MATCH) != 0; } @@ -153,49 +149,15 @@ public class JavaSearchPattern extends SearchPattern implements IIndexConstants boolean matchDifferentTypeSuffixes(int typeSuffix, int patternSuffix) { switch(typeSuffix) { case CLASS_SUFFIX : - switch (patternSuffix) { - case CLASS_AND_INTERFACE_SUFFIX : - case CLASS_AND_ENUM_SUFFIX : - return true; - } return false; case INTERFACE_SUFFIX : - switch (patternSuffix) { - case CLASS_AND_INTERFACE_SUFFIX : - case INTERFACE_AND_ANNOTATION_SUFFIX: - return true; - } return false; case ENUM_SUFFIX : - return patternSuffix == CLASS_AND_ENUM_SUFFIX; - - case ANNOTATION_TYPE_SUFFIX : - return patternSuffix == INTERFACE_AND_ANNOTATION_SUFFIX; - - case CLASS_AND_INTERFACE_SUFFIX : - switch (patternSuffix) { - case CLASS_SUFFIX : - case INTERFACE_SUFFIX : - return true; - } - return false; - - case CLASS_AND_ENUM_SUFFIX : - switch (patternSuffix) { - case CLASS_SUFFIX : - case ENUM_SUFFIX : - return true; - } return false; - case INTERFACE_AND_ANNOTATION_SUFFIX : - switch (patternSuffix) { - case INTERFACE_SUFFIX : - case ANNOTATION_TYPE_SUFFIX : - return true; - } + case ANNOTATION_TYPE_SUFFIX : return false; } @@ -231,9 +193,6 @@ public class JavaSearchPattern extends SearchPattern implements IIndexConstants output.append(" case sensitive"); //$NON-NLS-1$ else output.append(" case insensitive"); //$NON-NLS-1$ - if ((this.matchCompatibility & R_ERASURE_MATCH) != 0) { - output.append(", erasure only"); //$NON-NLS-1$ - } if ((this.matchCompatibility & R_EQUIVALENT_MATCH) != 0) { output.append(", equivalent oronly"); //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocator.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocator.java index 3a19e551..ada29fd0 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocator.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocator.java @@ -1672,8 +1672,6 @@ protected void report(SearchMatch match) throws CoreException { System.out.print("EXACT"); //$NON-NLS-1$ } else if (match.isEquivalent()) { System.out.print("EQUIVALENT"); //$NON-NLS-1$ - } else if (match.isErasure()) { - System.out.print("ERASURE"); //$NON-NLS-1$ } else { System.out.print("INVALID RULE"); //$NON-NLS-1$ } @@ -1745,41 +1743,38 @@ protected void reportAccurateParameterizedMethodReference(SearchMatch match, AST // If there's type arguments, look for end (ie. char '>') of last one. int start = match.getOffset(); if (typeArguments != null && typeArguments.length > 0) { - boolean isErasureMatch= (pattern instanceof OrPattern) ? ((OrPattern)pattern).isErasureMatch() : ((JavaSearchPattern)pattern).isErasureMatch(); - if (!isErasureMatch) { - - // Initialize scanner - Scanner scanner = this.parser.scanner; - char[] source = this.currentPossibleMatch.getContents(); - scanner.setSource(source); - - // Search previous opening '<' - start = typeArguments[0].sourceStart; - int end = statement.sourceEnd; - scanner.resetTo(start, end); - int lineStart = start; - try { - linesUp: while (true) { - while (scanner.source[scanner.currentPosition] != '\n') { - scanner.currentPosition--; - if (scanner.currentPosition == 0) break linesUp; - } - lineStart = scanner.currentPosition+1; - scanner.resetTo(lineStart, end); - while (!scanner.atEnd()) { - if (scanner.getNextToken() == TerminalTokens.TokenNameLESS) { - start = scanner.getCurrentTokenStartPosition(); - break linesUp; - } + + // Initialize scanner + Scanner scanner = this.parser.scanner; + char[] source = this.currentPossibleMatch.getContents(); + scanner.setSource(source); + + // Search previous opening '<' + start = typeArguments[0].sourceStart; + int end = statement.sourceEnd; + scanner.resetTo(start, end); + int lineStart = start; + try { + linesUp: while (true) { + while (scanner.source[scanner.currentPosition] != '\n') { + scanner.currentPosition--; + if (scanner.currentPosition == 0) break linesUp; + } + lineStart = scanner.currentPosition+1; + scanner.resetTo(lineStart, end); + while (!scanner.atEnd()) { + if (scanner.getNextToken() == TerminalTokens.TokenNameLESS) { + start = scanner.getCurrentTokenStartPosition(); + break linesUp; } - end = lineStart - 2; - scanner.currentPosition = end; } + end = lineStart - 2; + scanner.currentPosition = end; } - catch (InvalidInputException ex) { - // give up - } - } + } + catch (InvalidInputException ex) { + // give up + } } // Report match @@ -1806,9 +1801,8 @@ protected void reportAccurateParameterizedTypeReference(SearchMatch match, TypeR char[] source = this.currentPossibleMatch.getContents(); scanner.setSource(source); - boolean shouldMatchErasure= (pattern instanceof OrPattern) ? ((OrPattern)pattern).isErasureMatch() : ((JavaSearchPattern)pattern).isErasureMatch(); boolean hasSignatures = (pattern instanceof OrPattern) ? ((OrPattern)pattern).hasSignatures() : ((JavaSearchPattern)pattern).hasSignatures(); - if (shouldMatchErasure || !hasSignatures) { + if (!hasSignatures) { // if pattern is erasure only, then select the end of the reference if (typeRef instanceof QualifiedTypeReference && index >= 0) { long[] positions = ((QualifiedTypeReference) typeRef).sourcePositions; diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchingNodeSet.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchingNodeSet.java index 3edc1133..be387f88 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchingNodeSet.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchingNodeSet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,7 +13,6 @@ package org.eclipse.wst.jsdt.internal.core.search.matching; import java.util.ArrayList; import org.eclipse.wst.jsdt.core.search.SearchMatch; -import org.eclipse.wst.jsdt.core.search.SearchPattern; import org.eclipse.wst.jsdt.internal.compiler.ast.ASTNode; import org.eclipse.wst.jsdt.internal.compiler.util.HashtableOfLong; import org.eclipse.wst.jsdt.internal.compiler.util.SimpleLookupTable; @@ -33,7 +32,6 @@ SimpleLookupTable matchingNodes = new SimpleLookupTable(3); // node -> accuracy private HashtableOfLong matchingNodesKeys = new HashtableOfLong(3); // sourceRange -> node static Integer EXACT_MATCH = new Integer(SearchMatch.A_ACCURATE); static Integer POTENTIAL_MATCH = new Integer(SearchMatch.A_INACCURATE); -static Integer ERASURE_MATCH = new Integer(SearchPattern.R_ERASURE_MATCH); /** * Tell whether locators need to resolve or not for current matching node set. @@ -66,13 +64,6 @@ public int addMatch(ASTNode node, int matchLevel) { case PatternLocator.POSSIBLE_MATCH: addPossibleMatch(node); break; - case PatternLocator.ERASURE_MATCH: - if (matchLevel != maskedLevel) { - addTrustedMatch(node, new Integer(SearchPattern.R_ERASURE_MATCH+(matchLevel & PatternLocator.FLAVORS_MASK))); - } else { - addTrustedMatch(node, ERASURE_MATCH); - } - break; case PatternLocator.ACCURATE_MATCH: if (matchLevel != maskedLevel) { addTrustedMatch(node, new Integer(SearchMatch.A_ACCURATE+(matchLevel & PatternLocator.FLAVORS_MASK))); @@ -191,9 +182,6 @@ public String toString() { case SearchMatch.A_INACCURATE: result.append("INACCURATE_MATCH: "); //$NON-NLS-1$ break; - case SearchPattern.R_ERASURE_MATCH: - result.append("ERASURE_MATCH: "); //$NON-NLS-1$ - break; } node.print(0, result); } diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodLocator.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodLocator.java index 5d33254e..f7340979 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodLocator.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodLocator.java @@ -24,7 +24,6 @@ import org.eclipse.wst.jsdt.core.compiler.CharOperation; import org.eclipse.wst.jsdt.core.infer.InferredMethod; import org.eclipse.wst.jsdt.core.search.MethodDeclarationMatch; import org.eclipse.wst.jsdt.core.search.SearchMatch; -import org.eclipse.wst.jsdt.core.search.SearchPattern; import org.eclipse.wst.jsdt.internal.compiler.ast.ASTNode; import org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.wst.jsdt.internal.compiler.ast.Argument; @@ -296,13 +295,9 @@ protected void matchReportReference(ASTNode reference, IJavaScriptElement elemen } void matchReportReference(MessageSend messageSend, MatchLocator locator, MethodBinding methodBinding) throws CoreException { - if (this.pattern.hasMethodArguments()) { // binding has no type params, compatible erasure if pattern does - match.setRule(SearchPattern.R_ERASURE_MATCH); - } - // See whether it is necessary to report or not if (match.getRule() == 0) return; // impossible match - boolean report = (this.isErasureMatch && match.isErasure()) || (this.isEquivalentMatch && match.isEquivalent()) || match.isExact(); + boolean report = (this.isEquivalentMatch && match.isEquivalent()) || match.isExact(); if (!report) return; // Report match diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MultiTypeDeclarationPattern.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MultiTypeDeclarationPattern.java index 3f83c578..6f25076d 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MultiTypeDeclarationPattern.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MultiTypeDeclarationPattern.java @@ -164,18 +164,6 @@ protected StringBuffer print(StringBuffer output) { case CLASS_SUFFIX : output.append("MultiClassDeclarationPattern: "); //$NON-NLS-1$ break; - case CLASS_AND_INTERFACE_SUFFIX : - output.append("MultiClassAndInterfaceDeclarationPattern: "); //$NON-NLS-1$ - break; - case CLASS_AND_ENUM_SUFFIX : - output.append("MultiClassAndEnumDeclarationPattern: "); //$NON-NLS-1$ - break; - case INTERFACE_SUFFIX : - output.append("MultiInterfaceDeclarationPattern: "); //$NON-NLS-1$ - break; - case INTERFACE_AND_ANNOTATION_SUFFIX : - output.append("MultiInterfaceAndAnnotationDeclarationPattern: "); //$NON-NLS-1$ - break; case ENUM_SUFFIX : output.append("MultiEnumDeclarationPattern: "); //$NON-NLS-1$ break; diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/OrPattern.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/OrPattern.java index a1eb576a..3b0d1a4b 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/OrPattern.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/OrPattern.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -75,10 +75,6 @@ public class OrPattern extends SearchPattern implements IIndexConstants { return null; } - boolean isErasureMatch() { - return (this.matchCompatibility & R_ERASURE_MATCH) != 0; - } - boolean isPolymorphicSearch() { for (int i = 0, length = this.patterns.length; i < length; i++) if (((InternalSearchPattern) this.patterns[i]).isPolymorphicSearch()) return true; @@ -90,8 +86,7 @@ public class OrPattern extends SearchPattern implements IIndexConstants { * @return true if one at least of the stored pattern has signatures. */ public final boolean hasSignatures() { - boolean isErasureMatch = isErasureMatch(); - for (int i = 0, length = this.patterns.length; i < length && !isErasureMatch; i++) { + for (int i = 0, length = this.patterns.length; i < length; i++) { if (((JavaSearchPattern) this.patterns[i]).hasSignatures()) return true; } return false; diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/PatternLocator.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/PatternLocator.java index fda8902e..9aef17c0 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/PatternLocator.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/PatternLocator.java @@ -60,7 +60,6 @@ public static final int IMPOSSIBLE_MATCH = 0; public static final int INACCURATE_MATCH = 1; public static final int POSSIBLE_MATCH = 2; public static final int ACCURATE_MATCH = 3; -public static final int ERASURE_MATCH = 4; // Possible rule match flavors // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=79866 @@ -84,7 +83,7 @@ public static final int ALL_CONTAINER = COMPILATION_UNIT_CONTAINER | CLASS_CONTAINER | METHOD_CONTAINER | FIELD_CONTAINER; /* match rule */ -public static final int RAW_MASK = SearchPattern.R_EQUIVALENT_MATCH | SearchPattern.R_ERASURE_MATCH; +public static final int RAW_MASK = SearchPattern.R_EQUIVALENT_MATCH; public static final int RULE_MASK = RAW_MASK; // no other values for the while... public static PatternLocator patternLocator(SearchPattern pattern) { @@ -144,7 +143,6 @@ public PatternLocator(SearchPattern pattern) { int matchRule = pattern.getMatchRule(); this.isCaseSensitive = (matchRule & SearchPattern.R_CASE_SENSITIVE) != 0; this.isCamelCase = (matchRule & SearchPattern.R_CAMELCASE_MATCH) != 0; - this.isErasureMatch = (matchRule & SearchPattern.R_ERASURE_MATCH) != 0; this.isEquivalentMatch = (matchRule & SearchPattern.R_EQUIVALENT_MATCH) != 0; this.matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK; this.mustResolve = ((InternalSearchPattern)pattern).mustResolve; @@ -483,17 +481,10 @@ protected void updateMatch(TypeBinding[] argumentsBinding, MatchLocator locator, matchRule &= ~SearchPattern.R_FULL_MATCH; } } - if (hasTypeParameters) { - matchRule = SearchPattern.R_ERASURE_MATCH; - } // Compare arguments lengthes if (patternTypeArgsLength == typeArgumentsLength) { - if (!match.isRaw() && hasTypeParameters) { - // generic patterns are always not compatible match - match.setRule(SearchPattern.R_ERASURE_MATCH); - return; - } + } else { if (patternTypeArgsLength==0) { if (!match.isRaw() || hasTypeParameters) { @@ -539,8 +530,6 @@ protected void updateMatch(TypeBinding[] argumentsBinding, MatchLocator locator, break; } - // Argument does not match => erasure match will be the only possible one - match.setRule(SearchPattern.R_ERASURE_MATCH); return; } } diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java index 4e5d6828..026fa5f8 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -104,18 +104,9 @@ protected StringBuffer print(StringBuffer output) { case CLASS_SUFFIX : output.append("ClassDeclarationPattern: qualification<"); //$NON-NLS-1$ break; - case CLASS_AND_INTERFACE_SUFFIX: - output.append("ClassAndInterfaceDeclarationPattern: qualification<"); //$NON-NLS-1$ - break; - case CLASS_AND_ENUM_SUFFIX : - output.append("ClassAndEnumDeclarationPattern: qualification<"); //$NON-NLS-1$ - break; case INTERFACE_SUFFIX : output.append("InterfaceDeclarationPattern: qualification<"); //$NON-NLS-1$ break; - case INTERFACE_AND_ANNOTATION_SUFFIX: - output.append("InterfaceAndAnnotationDeclarationPattern: qualification<"); //$NON-NLS-1$ - break; case ENUM_SUFFIX : output.append("EnumDeclarationPattern: qualification<"); //$NON-NLS-1$ break; diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/SuperTypeReferenceLocator.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/SuperTypeReferenceLocator.java index 85cab1de..d427d29d 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/SuperTypeReferenceLocator.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/SuperTypeReferenceLocator.java @@ -88,10 +88,10 @@ public int resolveLevel(Binding binding) { ReferenceBinding type = (ReferenceBinding) binding; int level = IMPOSSIBLE_MATCH; - if (this.pattern.superRefKind != SuperTypeReferencePattern.ONLY_SUPER_INTERFACES) { - level = resolveLevelForType(this.pattern.superSimpleName, this.pattern.superQualification, type.superclass()); - if (level == ACCURATE_MATCH) return ACCURATE_MATCH; - } + + level = resolveLevelForType(this.pattern.superSimpleName, this.pattern.superQualification, type.superclass()); + if (level == ACCURATE_MATCH) return ACCURATE_MATCH; + return level; } public String toString() { diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/SuperTypeReferencePattern.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/SuperTypeReferencePattern.java index 9c5624b8..1ca86fe9 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/SuperTypeReferencePattern.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/SuperTypeReferencePattern.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,7 +36,6 @@ public char[][] typeParameterSignatures; protected int superRefKind; public static final int ALL_SUPER_TYPES = 0; -public static final int ONLY_SUPER_INTERFACES = 1; // used for IMPLEMENTORS public static final int ONLY_SUPER_CLASSES = 2; // used for hierarchy with a class focus protected static char[][] CATEGORIES = { SUPER_REF }; @@ -274,9 +273,6 @@ protected StringBuffer print(StringBuffer output) { case ALL_SUPER_TYPES: output.append("SuperTypeReferencePattern: <"); //$NON-NLS-1$ break; - case ONLY_SUPER_INTERFACES: - output.append("SuperInterfaceReferencePattern: <"); //$NON-NLS-1$ - break; case ONLY_SUPER_CLASSES: output.append("SuperClassReferencePattern: <"); //$NON-NLS-1$ break; diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeDeclarationLocator.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeDeclarationLocator.java index 1d4d084c..d5504bbb 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeDeclarationLocator.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeDeclarationLocator.java @@ -89,16 +89,8 @@ public int resolveLevel(Binding binding) { case CLASS_SUFFIX: if (!type.isClass()) return IMPOSSIBLE_MATCH; break; - case CLASS_AND_INTERFACE_SUFFIX: - if (!(type.isClass())) return IMPOSSIBLE_MATCH; - break; - case CLASS_AND_ENUM_SUFFIX: - if (!(type.isClass())) return IMPOSSIBLE_MATCH; - break; case INTERFACE_SUFFIX: return IMPOSSIBLE_MATCH; - case INTERFACE_AND_ANNOTATION_SUFFIX: - return IMPOSSIBLE_MATCH; case ENUM_SUFFIX: return IMPOSSIBLE_MATCH; case ANNOTATION_TYPE_SUFFIX: diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeDeclarationPattern.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeDeclarationPattern.java index 384389cd..80d438ec 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeDeclarationPattern.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeDeclarationPattern.java @@ -275,9 +275,6 @@ EntryResult[] queryIn(Index index) throws IOException { case INTERFACE_SUFFIX : case ENUM_SUFFIX : case ANNOTATION_TYPE_SUFFIX : - case CLASS_AND_INTERFACE_SUFFIX : - case CLASS_AND_ENUM_SUFFIX : - case INTERFACE_AND_ANNOTATION_SUFFIX : // null key already returns all types // key = new char[] {ONE_STAR[0], SEPARATOR, ONE_STAR[0]}; break; @@ -303,18 +300,9 @@ protected StringBuffer print(StringBuffer output) { case CLASS_SUFFIX : output.append("ClassDeclarationPattern: pkg<"); //$NON-NLS-1$ break; - case CLASS_AND_INTERFACE_SUFFIX: - output.append("ClassAndInterfaceDeclarationPattern: pkg<"); //$NON-NLS-1$ - break; - case CLASS_AND_ENUM_SUFFIX : - output.append("ClassAndEnumDeclarationPattern: pkg<"); //$NON-NLS-1$ - break; case INTERFACE_SUFFIX : output.append("InterfaceDeclarationPattern: pkg<"); //$NON-NLS-1$ break; - case INTERFACE_AND_ANNOTATION_SUFFIX: - output.append("InterfaceAndAnnotationDeclarationPattern: pkg<"); //$NON-NLS-1$ - break; case ENUM_SUFFIX : output.append("EnumDeclarationPattern: pkg<"); //$NON-NLS-1$ break; diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeReferenceLocator.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeReferenceLocator.java index 234c3a8d..276b1f29 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeReferenceLocator.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/TypeReferenceLocator.java @@ -482,10 +482,6 @@ protected void matchReportReference(QualifiedTypeReference qTypeRef, IJavaScript } void matchReportReference(Expression expr, int lastIndex, TypeBinding refBinding, MatchLocator locator) throws CoreException { - if (this.pattern.hasTypeArguments()) { // binding has no type params, compatible erasure if pattern does - match.setRule(SearchPattern.R_ERASURE_MATCH); - } - // Report match if (expr instanceof ArrayTypeReference) { locator.reportAccurateTypeReference(match, expr, this.pattern.simpleName); diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/codemanipulation/AddImportsOperation.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/codemanipulation/AddImportsOperation.java index f7033ce1..9ff96471 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/codemanipulation/AddImportsOperation.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/codemanipulation/AddImportsOperation.java @@ -349,11 +349,6 @@ public class AddImportsOperation implements IWorkspaceRunnable { switch (typeKinds & (CLASSES | INTERFACES | ENUMS | ANNOTATIONS)) { case CLASSES: return IJavaScriptSearchConstants.CLASS; - case INTERFACES: return IJavaScriptSearchConstants.INTERFACE; - case ENUMS: return IJavaScriptSearchConstants.ENUM; - case ANNOTATIONS: return IJavaScriptSearchConstants.ANNOTATION_TYPE; - case CLASSES | INTERFACES: return IJavaScriptSearchConstants.CLASS_AND_INTERFACE; - case CLASSES | ENUMS: return IJavaScriptSearchConstants.CLASS_AND_ENUM; default: return IJavaScriptSearchConstants.TYPE; } } diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/Checks.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/Checks.java index 68827d9f..65de42e6 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/Checks.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/Checks.java @@ -780,7 +780,7 @@ public class Checks { try{ if (! iType.isClass()) return false; - IType[] superTypes= iType.newSupertypeHierarchy(pm).getAllSupertypes(iType); + IType[] superTypes= iType.newSupertypeHierarchy(pm).getAllSuperclasses(iType); for (int i= 0; i < superTypes.length; i++) { if ("java.lang.Throwable".equals(superTypes[i].getFullyQualifiedName())) //$NON-NLS-1$ return true; diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/rename/RippleMethodFinder2.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/rename/RippleMethodFinder2.java index 4e9a76e3..227ecfd8 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/rename/RippleMethodFinder2.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/rename/RippleMethodFinder2.java @@ -279,7 +279,7 @@ public class RippleMethodFinder2 { private void findAllDeclarations(IProgressMonitor monitor, WorkingCopyOwner owner) throws CoreException { fDeclarations= new ArrayList(); - final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(SearchPattern.createPattern(fMethod, IJavaScriptSearchConstants.DECLARATIONS | IJavaScriptSearchConstants.IGNORE_DECLARING_TYPE | IJavaScriptSearchConstants.IGNORE_RETURN_TYPE, SearchPattern.R_ERASURE_MATCH | SearchPattern.R_CASE_SENSITIVE)); + final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(SearchPattern.createPattern(fMethod, IJavaScriptSearchConstants.DECLARATIONS | IJavaScriptSearchConstants.IGNORE_DECLARING_TYPE | IJavaScriptSearchConstants.IGNORE_RETURN_TYPE, SearchPattern.R_CASE_SENSITIVE)); if (owner != null) engine.setOwner(owner); engine.setScope(RefactoringScopeFactory.createRelatedProjectsScope(fMethod.getJavaScriptProject(), IJavaScriptSearchScope.SOURCES | IJavaScriptSearchScope.APPLICATION_LIBRARIES | IJavaScriptSearchScope.SYSTEM_LIBRARIES)); @@ -334,9 +334,8 @@ public class RippleMethodFinder2 { } private void uniteWithSupertypes(IType anchor, IType type) throws JavaScriptModelException { - IType[] supertypes= fHierarchy.getSupertypes(type); - for (int i= 0; i < supertypes.length; i++) { - IType supertype= supertypes[i]; + IType supertype= fHierarchy.getSuperclass(type); + if(supertype != null) { IType superRep= fUnionFind.find(supertype); if (superRep == null) { //Type doesn't declare method, but maybe supertypes? diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/ExtractSupertypeProcessor.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/ExtractSupertypeProcessor.java index d42c2db0..e21a2ac1 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/ExtractSupertypeProcessor.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/ExtractSupertypeProcessor.java @@ -798,7 +798,7 @@ public final class ExtractSupertypeProcessor extends PullUpRefactoringProcessor monitor.beginTask(RefactoringCoreMessages.ExtractSupertypeProcessor_computing_possible_types, 10); final IType superType= getDeclaringSuperTypeHierarchy(new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).getSuperclass(declaring); if (superType != null) { - fPossibleCandidates= superType.newTypeHierarchy(fOwner, new SubProgressMonitor(monitor, 9, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).getSubtypes(superType); + fPossibleCandidates= superType.newTypeHierarchy(fOwner, new SubProgressMonitor(monitor, 9, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).getSubclasses(superType); final LinkedList list= new LinkedList(Arrays.asList(fPossibleCandidates)); final Set names= new HashSet(); for (final Iterator iterator= list.iterator(); iterator.hasNext();) { diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/MemberVisibilityAdjustor.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/MemberVisibilityAdjustor.java index 3b393b48..ddcc0196 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/MemberVisibilityAdjustor.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/MemberVisibilityAdjustor.java @@ -1245,14 +1245,11 @@ public final class MemberVisibilityAdjustor { keyword= ModifierKeyword.PRIVATE_KEYWORD; else { final ITypeHierarchy hierarchy= getTypeHierarchy(referencing, new SubProgressMonitor(monitor, 1)); - final IType[] types= hierarchy.getSupertypes(referencing); - IType superType= null; - for (int index= 0; index < types.length; index++) { - superType= types[index]; - if (superType.equals(referenced.getDeclaringType())) { - keyword= ModifierKeyword.PROTECTED_KEYWORD; - return keyword; - } + final IType type= hierarchy.getSuperclass(referencing); + IType superType= type; + if (superType.equals(referenced.getDeclaringType())) { + keyword= ModifierKeyword.PROTECTED_KEYWORD; + return keyword; } } final IJavaScriptUnit typeUnit= referencing.getJavaScriptUnit(); @@ -1279,15 +1276,14 @@ public final class MemberVisibilityAdjustor { keyword= ModifierKeyword.PRIVATE_KEYWORD; else { final ITypeHierarchy hierarchy= getTypeHierarchy(referencing, new SubProgressMonitor(monitor, 1)); - final IType[] types= hierarchy.getSupertypes(referencing); - IType superType= null; - for (int index= 0; index < types.length; index++) { - superType= types[index]; - if (superType.equals(referenced.getDeclaringType())) { - keyword= ModifierKeyword.PROTECTED_KEYWORD; - return keyword; - } + final IType type= hierarchy.getSuperclass(referencing); + IType superType= type; + + if (superType.equals(referenced.getDeclaringType())) { + keyword= ModifierKeyword.PROTECTED_KEYWORD; + return keyword; } + } final IJavaScriptUnit typeUnit= referencing.getJavaScriptUnit(); if (referencedUnit != null && referencedUnit.equals(typeUnit)) { @@ -1316,14 +1312,12 @@ public final class MemberVisibilityAdjustor { keyword= ModifierKeyword.PRIVATE_KEYWORD; else { final ITypeHierarchy hierarchy= getTypeHierarchy(referencing, new SubProgressMonitor(monitor, 1)); - final IType[] types= hierarchy.getSupertypes(referencing); - IType superType= null; - for (int index= 0; index < types.length; index++) { - superType= types[index]; - if (superType.equals(referenced)) { - keyword= null; - return keyword; - } + final IType type= hierarchy.getSuperclass(referencing); + IType superType= type; + + if (superType.equals(referenced)) { + keyword= null; + return keyword; } } final IJavaScriptUnit typeUnit= referencing.getJavaScriptUnit(); diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.java index 06bfcead..ac0cee96 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.java @@ -2229,7 +2229,7 @@ public final class MoveInstanceMethodProcessor extends MoveProcessor implements if (method != null) found= true; } - types= hierarchy.getAllSupertypes(fMethod.getDeclaringType()); + types= hierarchy.getAllSuperclasses(fMethod.getDeclaringType()); for (int index= 0; index < types.length && !found; index++) { type= types[index]; method= JavaModelUtil.findMethod(fMethod.getElementName(), fMethod.getParameterTypes(), false, type); diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/PullUpRefactoringProcessor.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/PullUpRefactoringProcessor.java index 52f5ef43..91b96d78 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/PullUpRefactoringProcessor.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/refactoring/structure/PullUpRefactoringProcessor.java @@ -1319,7 +1319,7 @@ public class PullUpRefactoringProcessor extends HierarchyProcessor { public IType[] getCandidateTypes(final RefactoringStatus status, final IProgressMonitor monitor) throws JavaScriptModelException { final IType declaring= getDeclaringType(); - final IType[] superTypes= declaring.newSupertypeHierarchy(fOwner, monitor).getAllSupertypes(declaring); + final IType[] superTypes= declaring.newSupertypeHierarchy(fOwner, monitor).getAllSuperclasses(declaring); final List list= new ArrayList(superTypes.length); int binary= 0; for (int index= 0; index < superTypes.length; index++) { diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/template/java/CompilationUnitCompletion.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/template/java/CompilationUnitCompletion.java index acbe0ae3..c6bc5781 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/template/java/CompilationUnitCompletion.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/template/java/CompilationUnitCompletion.java @@ -159,7 +159,7 @@ final class CompilationUnitCompletion extends CompletionRequestor { return hierarchy.contains(sup); } else { ITypeHierarchy hierarchy= sub.newSupertypeHierarchy(null); - IType[] allTypes= hierarchy.getAllTypes(); + IType[] allTypes= hierarchy.getAllClasses(); for (int i= 0; i < allTypes.length; i++) { IType type= allTypes[i]; if (type.getElementName().equals(supertype)) @@ -199,7 +199,7 @@ final class CompilationUnitCompletion extends CompletionRequestor { return new IType[] {sup}; } else { ITypeHierarchy hierarchy= sub.newSupertypeHierarchy(null); - IType[] allTypes= hierarchy.getAllTypes(); + IType[] allTypes= hierarchy.getAllClasses(); List matches= new ArrayList(); for (int i= 0; i < allTypes.length; i++) { IType type= allTypes[i]; @@ -462,7 +462,7 @@ final class CompilationUnitCompletion extends CompletionRequestor { return false; ITypeHierarchy hierarchy= subType.newSupertypeHierarchy(null); - IType[] types= hierarchy.getAllSupertypes(subType); + IType[] types= hierarchy.getAllSuperclasses(subType); for (int i= 0; i < types.length; i++) if (types[i].equals(superType)) diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/template/java/JavaContext.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/template/java/JavaContext.java index c95aa7e3..c604ad3d 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/template/java/JavaContext.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/template/java/JavaContext.java @@ -528,11 +528,6 @@ public class JavaContext extends CompilationUnitContext { switch (typeKinds & (CLASSES | INTERFACES | ENUMS | ANNOTATIONS)) { case CLASSES: return IJavaScriptSearchConstants.CLASS; - case INTERFACES: return IJavaScriptSearchConstants.INTERFACE; - case ENUMS: return IJavaScriptSearchConstants.ENUM; - case ANNOTATIONS: return IJavaScriptSearchConstants.ANNOTATION_TYPE; - case CLASSES | INTERFACES: return IJavaScriptSearchConstants.CLASS_AND_INTERFACE; - case CLASSES | ENUMS: return IJavaScriptSearchConstants.CLASS_AND_ENUM; default: return IJavaScriptSearchConstants.TYPE; } } diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/JavaModelUtil.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/JavaModelUtil.java index 8adb5e50..0ad639fc 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/JavaModelUtil.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/JavaModelUtil.java @@ -542,7 +542,7 @@ public final class JavaModelUtil { public static IType[] getAllSuperTypes(IType type, IProgressMonitor pm) throws JavaScriptModelException { // workaround for 23656 - IType[] superTypes= SuperTypeHierarchyCache.getTypeHierarchy(type).getAllSupertypes(type); + IType[] superTypes= SuperTypeHierarchyCache.getTypeHierarchy(type).getAllSuperclasses(type); return superTypes; } diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/SearchUtils.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/SearchUtils.java index 916d4cc9..3d5e5eed 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/SearchUtils.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/SearchUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -60,7 +60,7 @@ public class SearchUtils { * Constant for use as matchRule in {@link SearchPattern#createPattern(IJavaScriptElement, int, int)} * to get search behavior as of 3.1M3 (all generic instantiations are found). */ - public final static int GENERICS_AGNOSTIC_MATCH_RULE= SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE | SearchPattern.R_ERASURE_MATCH; + public final static int GENERICS_AGNOSTIC_MATCH_RULE= SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE; /** * Returns whether the given pattern is a camel case pattern or not. diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/TypeInfoFilter.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/TypeInfoFilter.java index 6aa806b0..84c6d45c 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/TypeInfoFilter.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/util/TypeInfoFilter.java @@ -253,16 +253,6 @@ public class TypeInfoFilter { switch (fElementKind) { case IJavaScriptSearchConstants.CLASS: return modifiers == 0; - case IJavaScriptSearchConstants.ANNOTATION_TYPE: - return false; - case IJavaScriptSearchConstants.INTERFACE: - return false; - case IJavaScriptSearchConstants.ENUM: - return false; - case IJavaScriptSearchConstants.CLASS_AND_INTERFACE: - return modifiers == 0; - case IJavaScriptSearchConstants.CLASS_AND_ENUM: - return modifiers == 0; } return false; } diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java index 11555b45..67f4a704 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java @@ -681,7 +681,7 @@ public class FilteredTypesSelectionDialog extends FilteredItemsSelectionDialog i // make sure we search a concrete name. This is faster according to Kent "_______________".toCharArray(), //$NON-NLS-1$ SearchPattern.RULE_EXACT_MATCH | SearchPattern.RULE_CASE_SENSITIVE, - IJavaScriptSearchConstants.ENUM, + IJavaScriptSearchConstants.CLASS, SearchEngine.createWorkspaceScope(), new TypeNameRequestor() {}, IJavaScriptSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, @@ -1243,16 +1243,6 @@ public class FilteredTypesSelectionDialog extends FilteredItemsSelectionDialog i switch (fElemKind) { case IJavaScriptSearchConstants.CLASS: return modifiers == 0; - case IJavaScriptSearchConstants.ANNOTATION_TYPE: - return false; - case IJavaScriptSearchConstants.INTERFACE: - return false; - case IJavaScriptSearchConstants.ENUM: - return false; - case IJavaScriptSearchConstants.CLASS_AND_INTERFACE: - return modifiers == 0; - case IJavaScriptSearchConstants.CLASS_AND_ENUM: - return modifiers == 0; } return false; } diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/TypeInfoViewer.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/TypeInfoViewer.java index 2dce2d78..f2ca61d0 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/TypeInfoViewer.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/TypeInfoViewer.java @@ -719,7 +719,7 @@ public class TypeInfoViewer { // make sure we search a concrete name. This is faster according to Kent "_______________".toCharArray(), //$NON-NLS-1$ SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, - IJavaScriptSearchConstants.ENUM, + IJavaScriptSearchConstants.CLASS, SearchEngine.createWorkspaceScope(), new TypeNameRequestor() {}, IJavaScriptSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/TypeSelectionDialog2.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/TypeSelectionDialog2.java index b77d0505..a8cd3a20 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/TypeSelectionDialog2.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/dialogs/TypeSelectionDialog2.java @@ -311,7 +311,7 @@ public class TypeSelectionDialog2 extends SelectionStatusDialog { // make sure we search a concrete name. This is faster according to Kent "_______________".toCharArray(), //$NON-NLS-1$ SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, - IJavaScriptSearchConstants.ENUM, + IJavaScriptSearchConstants.CLASS, SearchEngine.createWorkspaceScope(), new TypeNameRequestor() {}, IJavaScriptSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/refactoring/PullUpMethodPage.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/refactoring/PullUpMethodPage.java index 3f4e3a0d..2fc358df 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/refactoring/PullUpMethodPage.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/refactoring/PullUpMethodPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. + * Copyright (c) 2006, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -88,7 +88,7 @@ public class PullUpMethodPage extends UserInputWizardPage { private static class PullUpFilter extends ViewerFilter { private static boolean anySubtypeCanBeShown(final IType type, final Map typeToMemberArray, final ITypeHierarchy hierarchy) { - final IType[] subTypes= hierarchy.getSubtypes(type); + final IType[] subTypes= hierarchy.getSubclasses(type); for (int i= 0; i < subTypes.length; i++) { if (canBeShown(subTypes[i], typeToMemberArray, hierarchy)) return true; diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/search/JavaSearchQuery.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/search/JavaSearchQuery.java index 62cebcba..ab1ad16e 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/search/JavaSearchQuery.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/search/JavaSearchQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -117,7 +117,7 @@ public class JavaSearchQuery implements ISearchQuery { } else { PatternQuerySpecification patternSpec = (PatternQuerySpecification) fPatternData; stringPattern= patternSpec.getPattern(); - int matchMode= getMatchMode(stringPattern) | SearchPattern.R_ERASURE_MATCH; + int matchMode= getMatchMode(stringPattern); if (patternSpec.isCaseSensitive()) matchMode |= SearchPattern.R_CASE_SENSITIVE; pattern= SearchPattern.createPattern(patternSpec.getPattern(), patternSpec.getSearchFor(), patternSpec.getLimitTo(), matchMode); diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/JavaOutlineInformationControl.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/JavaOutlineInformationControl.java index 1bbde270..8cbe8e52 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/JavaOutlineInformationControl.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/JavaOutlineInformationControl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -295,7 +295,7 @@ public class JavaOutlineInformationControl extends AbstractInformationControl { ITypeHierarchy th= getSuperTypeHierarchy(type); if (th != null) { List children= new ArrayList(); - IType[] superClasses= th.getAllSupertypes(type); + IType[] superClasses= th.getAllSuperclasses(type); children.addAll(Arrays.asList(super.getChildren(type))); for (int i= 0, scLength= superClasses.length; i < scLength; i++) children.addAll(Arrays.asList(super.getChildren(superClasses[i]))); @@ -715,7 +715,7 @@ public class JavaOutlineInformationControl extends AbstractInformationControl { if (hierarchy == null) return new IJavaScriptElement[] {fInput}; - IType[] supertypes= hierarchy.getAllSupertypes((IType)p); + IType[] supertypes= hierarchy.getAllSuperclasses((IType)p); IJavaScriptElement[] result= new IJavaScriptElement[supertypes.length + 1]; result[0]= fInput; System.arraycopy(supertypes, 0, result, 1, supertypes.length); diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/java/ContentAssistHistory.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/java/ContentAssistHistory.java index cbb7e655..1f65b15d 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/java/ContentAssistHistory.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/java/ContentAssistHistory.java @@ -369,7 +369,7 @@ public final class ContentAssistHistory { ITypeHierarchy hierarchy= rhs.newSupertypeHierarchy(getProgressMonitor()); if (hierarchy.contains(lhs)) { // TODO remember for every member of the LHS hierarchy or not? Yes for now. - IType[] allLHSides= hierarchy.getAllSupertypes(lhs); + IType[] allLHSides= hierarchy.getAllSuperclasses(lhs); for (int i= 0; i < allLHSides.length; i++) rememberInternal(allLHSides[i], rhs); rememberInternal(lhs, rhs); diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/MethodsContentProvider.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/MethodsContentProvider.java index 1713d053..b74e0a72 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/MethodsContentProvider.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/MethodsContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -87,7 +87,7 @@ public class MethodsContentProvider implements IStructuredContentProvider, IWork try { ITypeHierarchy hierarchy= fHierarchyLifeCycle.getHierarchy(); if (fShowInheritedMethods && hierarchy != null) { - IType[] allSupertypes= hierarchy.getAllSupertypes(type); + IType[] allSupertypes= hierarchy.getAllSuperclasses(type); // sort in from last to first: elements with same name // will show up in hierarchy order for (int i= allSupertypes.length - 1; i >= 0; i--) { diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/SubTypeHierarchyViewer.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/SubTypeHierarchyViewer.java index 9ba45009..7d850c9b 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/SubTypeHierarchyViewer.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/SubTypeHierarchyViewer.java @@ -67,7 +67,7 @@ public class SubTypeHierarchyViewer extends TypeHierarchyViewer { protected final void getTypesInHierarchy(IType type, List res) { ITypeHierarchy hierarchy= getHierarchy(); if (hierarchy != null) { - IType[] types= hierarchy.getSubtypes(type); + IType[] types= hierarchy.getSubclasses(type); if (isObject(type)) { for (int i= 0; i < types.length; i++) { IType curr= types[i]; diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/SuperTypeHierarchyViewer.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/SuperTypeHierarchyViewer.java index 12767060..432de48c 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/SuperTypeHierarchyViewer.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/SuperTypeHierarchyViewer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -62,7 +62,7 @@ public class SuperTypeHierarchyViewer extends TypeHierarchyViewer { protected final void getTypesInHierarchy(IType type, List res) { ITypeHierarchy hierarchy= getHierarchy(); if (hierarchy != null) { - IType[] types= hierarchy.getSupertypes(type); + IType[] types= new IType[]{hierarchy.getSuperclass(type)}; for (int i= 0; i < types.length; i++) { res.add(types[i]); } diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/TraditionalHierarchyViewer.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/TraditionalHierarchyViewer.java index 52809ffe..105db6f2 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/TraditionalHierarchyViewer.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/typehierarchy/TraditionalHierarchyViewer.java @@ -124,7 +124,7 @@ public class TraditionalHierarchyViewer extends TypeHierarchyViewer { protected final void getTypesInHierarchy(IType type, List res) { ITypeHierarchy hierarchy= getHierarchy(); if (hierarchy != null) { - IType[] types= hierarchy.getSubtypes(type); + IType[] types= hierarchy.getSubclasses(type); if (isObject(type)) { for (int i= 0; i < types.length; i++) { IType curr= types[i]; diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/IJavaScriptElementSearchConstants.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/IJavaScriptElementSearchConstants.java index 17f6826b..ef059472 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/IJavaScriptElementSearchConstants.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/IJavaScriptElementSearchConstants.java @@ -25,12 +25,6 @@ public interface IJavaScriptElementSearchConstants { */ public static final int CONSIDER_CLASSES= 1 << 1; - /** - * Search scope constant indicating that interfaces should be considered. - * Used when opening certain kinds of selection dialogs. - */ - public static final int CONSIDER_INTERFACES= 1 << 2; - /** * Search scope constant (bit mask) indicating that binaries should be considered. * Used when opening certain kinds of selection dialogs. @@ -75,14 +69,6 @@ public interface IJavaScriptElementSearchConstants { */ public static final int CONSIDER_ALL_TYPES= 1 << 8; - /** - * Search scope constant indicating that only classes and interfaces - * should be considered. - * - * - */ - public static final int CONSIDER_CLASSES_AND_INTERFACES= 1 << 9; - /** * Search scope constant indicating that only classes and enumeration types * should be considered. diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/JSdocContentAccess.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/JSdocContentAccess.java index 1192909c..6b95de55 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/JSdocContentAccess.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/JSdocContentAccess.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -273,7 +273,7 @@ public class JSdocContentAccess { MethodOverrideTester tester= new MethodOverrideTester(type, hierarchy); - IType[] superTypes= hierarchy.getAllSupertypes(type); + IType[] superTypes= hierarchy.getAllSuperclasses(type); for (int i= 0; i < superTypes.length; i++) { IType curr= superTypes[i]; IFunction overridden= tester.findOverriddenMethodInType(curr, method); diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/JavaScriptUI.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/JavaScriptUI.java index c6d91875..8ff163be 100644 --- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/JavaScriptUI.java +++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/JavaScriptUI.java @@ -522,18 +522,8 @@ public final class JavaScriptUI { int elementKinds= 0; if (style == IJavaScriptElementSearchConstants.CONSIDER_ALL_TYPES) { elementKinds= IJavaScriptSearchConstants.TYPE; - } else if (style == IJavaScriptElementSearchConstants.CONSIDER_INTERFACES) { - elementKinds= IJavaScriptSearchConstants.INTERFACE; - } else if (style == IJavaScriptElementSearchConstants.CONSIDER_CLASSES) { + }else if (style == IJavaScriptElementSearchConstants.CONSIDER_CLASSES) { elementKinds= IJavaScriptSearchConstants.CLASS; - } else if (style == IJavaScriptElementSearchConstants.CONSIDER_ANNOTATION_TYPES) { - elementKinds= IJavaScriptSearchConstants.ANNOTATION_TYPE; - } else if (style == IJavaScriptElementSearchConstants.CONSIDER_ENUMS) { - elementKinds= IJavaScriptSearchConstants.ENUM; - } else if (style == IJavaScriptElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES) { - elementKinds= IJavaScriptSearchConstants.CLASS_AND_INTERFACE; - } else if (style == IJavaScriptElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS) { - elementKinds= IJavaScriptSearchConstants.CLASS_AND_ENUM; } else { throw new IllegalArgumentException("Invalid style constant."); //$NON-NLS-1$ } -- cgit v1.2.3