Given the following interface:
interface Random extends java.util.function.Supplier<Integer> { }
with java.util.function.Supplier
looking like this (abbreviated):
public interface Supplier<T> { T get(); }
Now consider the following:
java.lang.reflect.Method get = Random.class.getMethod("get");
System.out.println(get.getReturnType()); // prints `class java.lang.Object`
System.out.println(get.getGenericReturnType()); // prints `T`
How can I infer that the return type should actually be java.lang.Integer
?
Aucun commentaire:
Enregistrer un commentaire