Skip to content

Commit aa21cee

Browse files
committed
Fix test0204c - issue with key for inner classes
Signed-off-by: Rob Stryker <[email protected]>
1 parent 309f390 commit aa21cee

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacTypeBinding.java

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,13 +459,31 @@ private String getKeyWithPossibleGenerics(Type t, TypeSymbol s, Function<ITypeBi
459459
return ret;
460460
}
461461

462-
String base1 = getKey(t, s.flatName(), false, useSlashes);
463-
String base = removeTrailingSemicolon(base1);
464-
if( isRawType(t)) {
465-
return base + "<>;";
462+
String base1 = null;
463+
String base = null;
464+
if( isMember()) {
465+
TypeSymbol owner = s != null ? s.owner instanceof ClassSymbol ts1a ? ts1a : null : null;
466+
Type ownerType = owner != null ? owner.type : null;
467+
if(ownerType != null && t != null && (isParameterizedType(t) || isRawType(t))) {
468+
base1 = getGenericTypeSignature(ownerType, owner, false);
469+
base = removeTrailingSemicolon(base1);
470+
boolean semiRemoved = base1.length() != base.length();
471+
String nameAsString = s.getSimpleName().toString();
472+
if (useSlashes) {
473+
nameAsString = nameAsString.replace('.', '/');
474+
}
475+
nameAsString = nameAsString.replaceFirst("\\$([0-9]+)([A-Za-z$_][A-Za-z$_0-9]*)", "\\$$1\\$$2");
476+
base += "." + nameAsString;
477+
base1 = semiRemoved ? base + ";" : base;
478+
}
479+
}
480+
if( base == null ) {
481+
base1 = getKey(t, s.flatName(), false, useSlashes);
482+
base = removeTrailingSemicolon(base1);
483+
if( isRawType(t)) {
484+
return base + "<>;";
485+
}
466486
}
467-
468-
469487

470488
if (isGenericType(t)) {
471489
return base + '<'

0 commit comments

Comments
 (0)