diff --git a/spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java b/spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java index 2c049da8479..403c11e7ffe 100644 --- a/spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java +++ b/spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -194,6 +194,15 @@ class GenericTypeResolverTests { assertThat(resolved).isEqualTo(E.class); } + @Test + public void resolveMethodParameterWithNestedGenerics() { + Method method = method(WithMethodParameter.class, "nestedGenerics", List.class); + MethodParameter methodParameter = new MethodParameter(method, 0); + Type resolvedType = resolveType(methodParameter.getGenericParameterType(), WithMethodParameter.class); + ParameterizedTypeReference>> reference = new ParameterizedTypeReference<>() {}; + assertThat(resolvedType).isEqualTo(reference.getType()); + } + private static Method method(Class target, String methodName, Class... parameterTypes) { Method method = findMethod(target, methodName, parameterTypes); assertThat(method).describedAs(target.getName() + "#" + methodName).isNotNull(); @@ -388,5 +397,10 @@ class GenericTypeResolverTests { static class SecondFirstService implements Second, First { } + static class WithMethodParameter { + public void nestedGenerics(List> input) { + } + } + }