Index: search/org/eclipse/jdt/internal/core/index/DiskIndex.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java,v retrieving revision 1.37 diff -u -r1.37 DiskIndex.java --- search/org/eclipse/jdt/internal/core/index/DiskIndex.java 7 Jun 2005 12:00:10 -0000 1.37 +++ search/org/eclipse/jdt/internal/core/index/DiskIndex.java 15 Jun 2005 10:56:19 -0000 @@ -35,7 +35,7 @@ private HashtableOfObject categoryTables; // category name -> HashtableOfObject(words -> int[] of document #'s) or offset if not read yet private char[] cachedCategoryName; -public static final String SIGNATURE= "INDEX VERSION 1.105"; //$NON-NLS-1$ +public static final String SIGNATURE= "INDEX VERSION 1.106"; //$NON-NLS-1$ public static boolean DEBUG = false; private static final int RE_INDEXED = -1; Index: search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java,v retrieving revision 1.32 diff -u -r1.32 SourceIndexerRequestor.java --- search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java 7 Jun 2005 12:00:10 -0000 1.32 +++ search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java 15 Jun 2005 10:56:19 -0000 @@ -145,15 +145,15 @@ private void enterClass(TypeInfo typeInfo) { // eliminate possible qualifications, given they need to be fully resolved again - if (typeInfo.superclass != null){ - typeInfo.superclass = CharOperation.lastSegment(typeInfo.superclass, '.'); + if (typeInfo.superclass != null) { + typeInfo.superclass = getSimpleName(typeInfo.superclass); // add implicit constructor reference to default constructor this.indexer.addConstructorReference(typeInfo.superclass, 0); } if (typeInfo.superinterfaces != null){ - for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++){ - typeInfo.superinterfaces[i] = CharOperation.lastSegment(typeInfo.superinterfaces[i], '.'); + for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++) { + typeInfo.superinterfaces[i] = getSimpleName(typeInfo.superinterfaces[i]); } } char[][] typeNames; @@ -191,7 +191,7 @@ // eliminate possible qualifications, given they need to be fully resolved again if (typeInfo.superinterfaces != null){ for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++){ - typeInfo.superinterfaces[i] = CharOperation.lastSegment(typeInfo.superinterfaces[i], '.'); + typeInfo.superinterfaces[i] = getSimpleName(typeInfo.superinterfaces[i]); } } char[][] typeNames; @@ -220,7 +220,7 @@ // eliminate possible qualifications, given they need to be fully resolved again if (typeInfo.superinterfaces != null){ for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++){ - typeInfo.superinterfaces[i] = CharOperation.lastSegment(typeInfo.superinterfaces[i], '.'); + typeInfo.superinterfaces[i] = getSimpleName(typeInfo.superinterfaces[i]); } } char[][] typeNames; @@ -305,6 +305,35 @@ public void exitType(int declarationEnd) { popTypeName(); } +/* + * Returns the unqualified name without parameters from the given type name. + */ +private char[] getSimpleName(char[] typeName) { + int lastDot = -1; + int length = length = typeName.length; + int lastGenericStart = length; + int depthCount = 0; + for (int i = 0; i < length; i++) { + char c = typeName[i]; + switch (c) { + case '.': + if (depthCount == 0) + lastDot = i; + break; + case '<': + if (depthCount == 0) + lastGenericStart = i; + depthCount++; + break; + case '>': + depthCount--; + break; + } + } + if (lastDot == -1 && lastGenericStart == length) + return typeName; + return CharOperation.subarray(typeName, lastDot+1, lastGenericStart); +} public void popTypeName() { if (depth > 0) { enclosingTypeNames[--depth] = null;