Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javac: Extract type variable name using the element #10293

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading