In short, I have a method which takes a list of an interface, but when I provide such a list via generic constraint <C extends FooInterface>
, it doesn't work:
public class Utils {
public void testMethod(List<FooInterface> list){}
}
public class TestClass<C extends FooInterface> {
public final List<C> lists;
public TestClass(){
Utils.testMethod(lists); //<< this does not work because "C" is not "FooInterface"
}
}
I think this should work as I defined C
as implements FooInterface
.