|
39 | 39 | * @author Rob Harrop
|
40 | 40 | * @author Sam Brannen
|
41 | 41 | * @author Phillip Webb
|
| 42 | + * @author Yanming Zhou |
42 | 43 | * @since 2.5.2
|
43 | 44 | */
|
44 | 45 | public final class GenericTypeResolver {
|
@@ -167,22 +168,25 @@ public static Type resolveType(Type genericType, @Nullable Class<?> contextClass
|
167 | 168 | else if (genericType instanceof ParameterizedType parameterizedType) {
|
168 | 169 | ResolvableType resolvedType = ResolvableType.forType(genericType);
|
169 | 170 | if (resolvedType.hasUnresolvableGenerics()) {
|
170 |
| - Class<?>[] generics = new Class<?>[parameterizedType.getActualTypeArguments().length]; |
| 171 | + ResolvableType[] generics = new ResolvableType[parameterizedType.getActualTypeArguments().length]; |
171 | 172 | Type[] typeArguments = parameterizedType.getActualTypeArguments();
|
172 | 173 | ResolvableType contextType = ResolvableType.forClass(contextClass);
|
173 | 174 | for (int i = 0; i < typeArguments.length; i++) {
|
174 | 175 | Type typeArgument = typeArguments[i];
|
175 | 176 | if (typeArgument instanceof TypeVariable<?> typeVariable) {
|
176 | 177 | ResolvableType resolvedTypeArgument = resolveVariable(typeVariable, contextType);
|
177 | 178 | if (resolvedTypeArgument != ResolvableType.NONE) {
|
178 |
| - generics[i] = resolvedTypeArgument.resolve(); |
| 179 | + generics[i] = resolvedTypeArgument; |
179 | 180 | }
|
180 | 181 | else {
|
181 |
| - generics[i] = ResolvableType.forType(typeArgument).resolve(); |
| 182 | + generics[i] = ResolvableType.forType(typeArgument); |
182 | 183 | }
|
183 | 184 | }
|
| 185 | + else if (typeArgument instanceof ParameterizedType) { |
| 186 | + generics[i] = ResolvableType.forType(resolveType(typeArgument, contextClass)); |
| 187 | + } |
184 | 188 | else {
|
185 |
| - generics[i] = ResolvableType.forType(typeArgument).resolve(); |
| 189 | + generics[i] = ResolvableType.forType(typeArgument); |
186 | 190 | }
|
187 | 191 | }
|
188 | 192 | Class<?> rawClass = resolvedType.getRawClass();
|
|
0 commit comments