Skip to content

Commit

Permalink
Javac: Extract type variable name using the element (#10293)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstepanov committed Jan 2, 2024
1 parent 97aeb96 commit 0295ee0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ private Map<String, TypeMirror> resolveGenericTypes(DeclaredType type, TypeEleme
break;
case TYPEVAR:
TypeVariable tv = (TypeVariable) mirror;
if (boundTypes.containsKey(tv.toString())) {
resolvedParameters.put(parameterName, boundTypes.get(tv.toString()));
String variableName = tv.asElement().getSimpleName().toString();
if (boundTypes.containsKey(variableName)) {
resolvedParameters.put(parameterName, boundTypes.get(variableName));
} else {
TypeMirror upperBound = tv.getUpperBound();
TypeMirror lowerBound = tv.getLowerBound();
Expand Down Expand Up @@ -195,7 +196,7 @@ protected TypeMirror resolveTypeReference(TypeMirror mirror, Map<String, TypeMir
switch (kind) {
case TYPEVAR:
TypeVariable tv = (TypeVariable) mirror;
String name = tv.toString();
String name = tv.asElement().getSimpleName().toString();
if (boundTypes.containsKey(name)) {
return boundTypes.get(name);
} else {
Expand Down Expand Up @@ -251,7 +252,7 @@ private void resolveGenericTypeParameter(Map<String, TypeMirror> resolvedParamet
mirror
);
} else if (mirror instanceof TypeVariable tv) {
String variableName = tv.toString();
String variableName = tv.asElement().getSimpleName().toString();
if (boundTypes.containsKey(variableName)) {
resolvedParameters.put(
parameterName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ private ClassElement resolveTypeVariable(JavaNativeElement owner,
Set<TypeMirror> visitedTypes,
TypeVariable tv,
boolean isRawType) {
String variableName = tv.toString();
String variableName = tv.asElement().getSimpleName().toString();
ClassElement resolvedBound = parentTypeArguments.get(variableName);
List<JavaClassElement> bounds = null;
io.micronaut.inject.ast.Element declaredElement = this;
Expand Down

0 comments on commit 0295ee0

Please sign in to comment.