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 16 Jun 2005 10:19:47 -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 16 Jun 2005 10:19:47 -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,38 @@ 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, lastGenericStart = -1; + int depthCount = 0; + int length = typeName.length; + lastDotLookup: for (int i = length -1; i >= 0; i--) { + switch (typeName[i]) { + case '.': + if (depthCount == 0) { + lastDot = i; + break lastDotLookup; + } + break; + case '<': + depthCount--; + if (depthCount == 0) lastGenericStart = i; + break; + case '>': + depthCount++; + break; + } + } + if (lastGenericStart < 0) { + if (lastDot < 0) { + return typeName; + } + return CharOperation.subarray(typeName, lastDot + 1, length); + } + return CharOperation.subarray(typeName, lastDot + 1, lastGenericStart); +} public void popTypeName() { if (depth > 0) { enclosingTypeNames[--depth] = null;