Lines 145-159
Link Here
|
145 |
private void enterClass(TypeInfo typeInfo) { |
145 |
private void enterClass(TypeInfo typeInfo) { |
146 |
|
146 |
|
147 |
// eliminate possible qualifications, given they need to be fully resolved again |
147 |
// eliminate possible qualifications, given they need to be fully resolved again |
148 |
if (typeInfo.superclass != null){ |
148 |
if (typeInfo.superclass != null) { |
149 |
typeInfo.superclass = CharOperation.lastSegment(typeInfo.superclass, '.'); |
149 |
typeInfo.superclass = getSimpleName(typeInfo.superclass); |
150 |
|
150 |
|
151 |
// add implicit constructor reference to default constructor |
151 |
// add implicit constructor reference to default constructor |
152 |
this.indexer.addConstructorReference(typeInfo.superclass, 0); |
152 |
this.indexer.addConstructorReference(typeInfo.superclass, 0); |
153 |
} |
153 |
} |
154 |
if (typeInfo.superinterfaces != null){ |
154 |
if (typeInfo.superinterfaces != null){ |
155 |
for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++){ |
155 |
for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++) { |
156 |
typeInfo.superinterfaces[i] = CharOperation.lastSegment(typeInfo.superinterfaces[i], '.'); |
156 |
typeInfo.superinterfaces[i] = getSimpleName(typeInfo.superinterfaces[i]); |
157 |
} |
157 |
} |
158 |
} |
158 |
} |
159 |
char[][] typeNames; |
159 |
char[][] typeNames; |
Lines 191-197
Link Here
|
191 |
// eliminate possible qualifications, given they need to be fully resolved again |
191 |
// eliminate possible qualifications, given they need to be fully resolved again |
192 |
if (typeInfo.superinterfaces != null){ |
192 |
if (typeInfo.superinterfaces != null){ |
193 |
for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++){ |
193 |
for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++){ |
194 |
typeInfo.superinterfaces[i] = CharOperation.lastSegment(typeInfo.superinterfaces[i], '.'); |
194 |
typeInfo.superinterfaces[i] = getSimpleName(typeInfo.superinterfaces[i]); |
195 |
} |
195 |
} |
196 |
} |
196 |
} |
197 |
char[][] typeNames; |
197 |
char[][] typeNames; |
Lines 220-226
Link Here
|
220 |
// eliminate possible qualifications, given they need to be fully resolved again |
220 |
// eliminate possible qualifications, given they need to be fully resolved again |
221 |
if (typeInfo.superinterfaces != null){ |
221 |
if (typeInfo.superinterfaces != null){ |
222 |
for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++){ |
222 |
for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++){ |
223 |
typeInfo.superinterfaces[i] = CharOperation.lastSegment(typeInfo.superinterfaces[i], '.'); |
223 |
typeInfo.superinterfaces[i] = getSimpleName(typeInfo.superinterfaces[i]); |
224 |
} |
224 |
} |
225 |
} |
225 |
} |
226 |
char[][] typeNames; |
226 |
char[][] typeNames; |
Lines 305-310
Link Here
|
305 |
public void exitType(int declarationEnd) { |
305 |
public void exitType(int declarationEnd) { |
306 |
popTypeName(); |
306 |
popTypeName(); |
307 |
} |
307 |
} |
|
|
308 |
/* |
309 |
* Returns the unqualified name without parameters from the given type name. |
310 |
*/ |
311 |
private char[] getSimpleName(char[] typeName) { |
312 |
int lastDot = -1, lastGenericStart = -1; |
313 |
int depthCount = 0; |
314 |
int length = typeName.length; |
315 |
lastDotLookup: for (int i = length -1; i >= 0; i--) { |
316 |
switch (typeName[i]) { |
317 |
case '.': |
318 |
if (depthCount == 0) { |
319 |
lastDot = i; |
320 |
break lastDotLookup; |
321 |
} |
322 |
break; |
323 |
case '<': |
324 |
depthCount--; |
325 |
if (depthCount == 0) lastGenericStart = i; |
326 |
break; |
327 |
case '>': |
328 |
depthCount++; |
329 |
break; |
330 |
} |
331 |
} |
332 |
if (lastGenericStart < 0) { |
333 |
if (lastDot < 0) { |
334 |
return typeName; |
335 |
} |
336 |
return CharOperation.subarray(typeName, lastDot + 1, length); |
337 |
} |
338 |
return CharOperation.subarray(typeName, lastDot + 1, lastGenericStart); |
339 |
} |
308 |
public void popTypeName() { |
340 |
public void popTypeName() { |
309 |
if (depth > 0) { |
341 |
if (depth > 0) { |
310 |
enclosingTypeNames[--depth] = null; |
342 |
enclosingTypeNames[--depth] = null; |