I have a class defined like so:
public class Test {
static <T> List<Class<T>> filter(List<Class<T>> input) {
// code here
}
public static void main(String[] args) {
List<Class<? extends Throwable>> list =
new ArrayList<Class<? extends Throwable>>();
filter(list);
}
}
The filter
method call in main
gives the following compile error:
The method filter(List<Class<T>>) in the type Test is not applicable for the
arguments (List<Class<? extends Throwable>>)
I don't understand why <T>
doesn't bind to <? extends Throwable>
. Are there any generics gurus who can help me?