Index: model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java,v retrieving revision 1.91 diff -u -r1.91 IndexBasedHierarchyBuilder.java --- model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java 24 Jun 2005 16:17:08 -0000 1.91 +++ model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java 6 Sep 2005 11:12:12 -0000 @@ -468,8 +468,14 @@ } }; + int superRefKind; + try { + superRefKind = type.isClass() ? SuperTypeReferencePattern.ONLY_SUPER_CLASSES : SuperTypeReferencePattern.ALL_SUPER_TYPES; + } catch (JavaModelException e) { + superRefKind = SuperTypeReferencePattern.ALL_SUPER_TYPES; + } SuperTypeReferencePattern pattern = - new SuperTypeReferencePattern(null, null, false, SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE); + new SuperTypeReferencePattern(null, null, superRefKind, SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE); MatchLocator.setFocus(pattern, type); SubTypeSearchJob job = new SubTypeSearchJob( pattern, Index: search/org/eclipse/jdt/core/search/SearchPattern.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java,v retrieving revision 1.42 diff -u -r1.42 SearchPattern.java --- search/org/eclipse/jdt/core/search/SearchPattern.java 27 Apr 2005 21:06:38 -0000 1.42 +++ search/org/eclipse/jdt/core/search/SearchPattern.java 6 Sep 2005 11:12:14 -0000 @@ -1252,7 +1252,7 @@ return new SuperTypeReferencePattern( CharOperation.concatWith(packageName, enclosingTypeNames, '.'), simpleName, - true, + SuperTypeReferencePattern.ONLY_SUPER_INTERFACES, matchRule); case IJavaSearchConstants.ALL_OCCURRENCES : return new OrPattern( @@ -1376,7 +1376,7 @@ case IJavaSearchConstants.REFERENCES : return new TypeReferencePattern(qualificationChars, typeChars, typeSignature, matchRule); case IJavaSearchConstants.IMPLEMENTORS : - return new SuperTypeReferencePattern(qualificationChars, typeChars, true, matchRule); + return new SuperTypeReferencePattern(qualificationChars, typeChars, SuperTypeReferencePattern.ONLY_SUPER_INTERFACES, matchRule); case IJavaSearchConstants.ALL_OCCURRENCES : return new OrPattern( new QualifiedTypeDeclarationPattern(qualificationChars, typeChars, indexSuffix, matchRule),// cannot search for explicit member types Index: search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java,v retrieving revision 1.20 diff -u -r1.20 ClassFileMatchLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java 26 Apr 2005 18:55:06 -0000 1.20 +++ search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java 6 Sep 2005 11:12:14 -0000 @@ -212,7 +212,7 @@ if (!(binaryInfo instanceof IBinaryType)) return false; IBinaryType type = (IBinaryType) binaryInfo; - if (!pattern.checkOnlySuperinterfaces) { + if (pattern.superRefKind != SuperTypeReferencePattern.ONLY_SUPER_INTERFACES) { char[] vmName = type.getSuperclassName(); if (vmName != null) { char[] superclassName = convertClassFileFormat(vmName); @@ -221,12 +221,14 @@ } } - 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())) - 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())) + return true; + } } } return false; Index: search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java,v retrieving revision 1.10 diff -u -r1.10 SuperTypeReferenceLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java 23 Feb 2005 02:47:46 -0000 1.10 +++ search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java 6 Sep 2005 11:12:14 -0000 @@ -68,17 +68,19 @@ ReferenceBinding type = (ReferenceBinding) binding; int level = IMPOSSIBLE_MATCH; - if (!this.pattern.checkOnlySuperinterfaces) { + 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; } - ReferenceBinding[] superInterfaces = type.superInterfaces(); - for (int i = 0, max = superInterfaces.length; i < max; i++) { - int newLevel = resolveLevelForType(this.pattern.superSimpleName, this.pattern.superQualification, superInterfaces[i]); - if (newLevel > level) { - if (newLevel == ACCURATE_MATCH) return ACCURATE_MATCH; - level = newLevel; + if (this.pattern.superRefKind != SuperTypeReferencePattern.ONLY_SUPER_CLASSES) { + ReferenceBinding[] superInterfaces = type.superInterfaces(); + for (int i = 0, max = superInterfaces.length; i < max; i++) { + int newLevel = resolveLevelForType(this.pattern.superSimpleName, this.pattern.superQualification, superInterfaces[i]); + if (newLevel > level) { + if (newLevel == ACCURATE_MATCH) return ACCURATE_MATCH; + level = newLevel; + } } } return level; Index: search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java,v retrieving revision 1.50 diff -u -r1.50 SuperTypeReferencePattern.java --- search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java 23 Feb 2005 02:47:38 -0000 1.50 +++ search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java 6 Sep 2005 11:12:14 -0000 @@ -30,7 +30,10 @@ public int modifiers; public char[][] typeParameterSignatures; -protected boolean checkOnlySuperinterfaces; // used for IMPLEMENTORS +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 hierarachy with a class focus protected static char[][] CATEGORIES = { SUPER_REF }; @@ -139,7 +142,7 @@ public SuperTypeReferencePattern( char[] superQualification, char[] superSimpleName, - boolean checkOnlySuperinterfaces, + int superRefKind, int matchRule) { this(matchRule); @@ -147,7 +150,7 @@ this.superQualification = isCaseSensitive() ? superQualification : CharOperation.toLowerCase(superQualification); this.superSimpleName = isCaseSensitive() ? superSimpleName : CharOperation.toLowerCase(superSimpleName); ((InternalSearchPattern)this).mustResolve = superQualification != null; - this.checkOnlySuperinterfaces = checkOnlySuperinterfaces; // ie. skip the superclass + this.superRefKind = superRefKind; } SuperTypeReferencePattern(int matchRule) { super(SUPER_REF_PATTERN, matchRule); @@ -203,8 +206,13 @@ } public boolean matchesDecodedKey(SearchPattern decodedPattern) { SuperTypeReferencePattern pattern = (SuperTypeReferencePattern) decodedPattern; - if (this.checkOnlySuperinterfaces) + if (this.superRefKind == ONLY_SUPER_INTERFACES) if (pattern.superClassOrInterface != IIndexConstants.INTERFACE_SUFFIX) return false; + if (this.superRefKind == ONLY_SUPER_CLASSES && pattern.enclosingTypeName != IIndexConstants.ONE_ZERO/*not an anonymous*/) + // consider enumerations as classes, reject interfaces and annotations + if (pattern.superClassOrInterface == IIndexConstants.INTERFACE_SUFFIX + || pattern.superClassOrInterface == IIndexConstants.ANNOTATION_TYPE_SUFFIX) + return false; if (pattern.superQualification != null) if (!matchesName(this.superQualification, pattern.superQualification)) return false; @@ -234,10 +242,17 @@ return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null } protected StringBuffer print(StringBuffer output) { - output.append( - this.checkOnlySuperinterfaces - ? "SuperInterfaceReferencePattern: <" //$NON-NLS-1$ - : "SuperTypeReferencePattern: <"); //$NON-NLS-1$ + switch (this.superRefKind) { + 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; + } if (superSimpleName != null) output.append(superSimpleName); else