-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
GenericTypeResolver.resolveType() should resolve ParameterizedType recursively #24963
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: superseded
An issue that has been superseded by another
type: enhancement
A general enhancement
Comments
Type type = m.getGenericReturnType(); // List<List<T>>
ResolvableType.forType(type).hasUnresolvableGenerics(); //should be true but false |
Here is my workaround public static Type resolve(Type type, Class<?> contextClass) {
if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) type;
ResolvableType[] generics = new ResolvableType[pt.getActualTypeArguments().length];
int i = 0;
for (Type arg : pt.getActualTypeArguments()) {
generics[i++] = ResolvableType.forType(resolve(arg, contextClass));
}
return ResolvableType.forClassWithGenerics((Class<?>) pt.getRawType(), generics).getType();
}
return GenericTypeResolver.resolveType(type, contextClass);
} |
This comment was marked as duplicate.
This comment was marked as duplicate.
Superseded by #30079 |
quaff
added a commit
to quaff/spring-framework
that referenced
this issue
Nov 30, 2023
jhoeller
pushed a commit
that referenced
this issue
Feb 15, 2024
Loading
Loading status checks…
Fix GH-24963
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: superseded
An issue that has been superseded by another
type: enhancement
A general enhancement
will print
The expected type for m3 should be
java.util.List<java.util.List<String>>
The text was updated successfully, but these errors were encountered: