Skip to content

Commit

Permalink
Fix test0037 - getKey on JavacTypeVariableBinding
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <stryker@redhat.com>
  • Loading branch information
Rob Stryker authored and mickaelistria committed Aug 14, 2024
1 parent 74d8fa3 commit 4706af9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,26 +268,28 @@ private static String removeTrailingSemicolon(String key) {
return key.endsWith(";") ? key.substring(0, key.length() - 1) : key;
}

private String getKey(Type t) {
return getKey(t, this.typeSymbol.flatName());
}

public String getKey(boolean includeTypeParameters) {
return getKey(this.type, this.typeSymbol.flatName(), includeTypeParameters);
}

private String getKey(Type t) {
return getKey(t, this.typeSymbol.flatName());
}
public String getKey(Type t, Name n) {
return getKey(type, n, true);
}
public static String getKey(Type t, Name n, boolean includeTypeParameters) {
try {
StringBuilder builder = new StringBuilder();
getKey(builder, t, n, false, true);
getKey(builder, t, n, false, includeTypeParameters);
return builder.toString();
} catch(BindingKeyException bke) {
return null;
}
}


static void getKey(StringBuilder builder, Type typeToBuild, boolean isLeaf) throws BindingKeyException {
getKey(builder, typeToBuild, typeToBuild.asElement().flatName(), isLeaf, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ public String getKey() {
if (this.sym.owner != null) {
IBinding ownerBinding = this.bindingResolver.bindings.getBinding(this.sym.owner, null);
if (ownerBinding != null) {
builder.append(ownerBinding.getKey());
if( ownerBinding instanceof JavacTypeBinding jctb && !(ownerBinding instanceof JavacTypeVariableBinding)) {
builder.append(jctb.getKey(false));
} else {
builder.append(ownerBinding.getKey());
}
}
}
builder.append(":T");
Expand Down

0 comments on commit 4706af9

Please sign in to comment.