-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed as not planned
Closed as not planned
Copy link
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: enhancementA general enhancementA general enhancement
Description
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.List;
import org.springframework.core.GenericTypeResolver;
public class Main {
public interface Parent<T> {
T m1();
List<T> m2();
List<List<T>> m3();
}
public interface Child extends Parent<String> {
}
public static void main(String[] args) {
for (Method m : Parent.class.getMethods()) {
Type type = m.getGenericReturnType();
type = GenericTypeResolver.resolveType(type, Child.class);
System.out.println("method " + m.getName() + "() will return " + type);
}
}
}
will print
method m3() will return java.util.List<java.util.List<T>>
method m1() will return class java.lang.String
method m2() will return java.util.List<java.lang.String>
The expected type for m3 should be java.util.List<java.util.List<String>>
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: enhancementA general enhancementA general enhancement