I have the following interface and class definitions...
abstract interface I{}
class Foo implements I{}
abstract class A<T extends I> {
List<T> list;
}
class B extends A<Foo> {}
All the definitions work fine. I then want to do the following:
A b = new B();
List<? extends I> iList = b.list;
The compiler will indeed give me an Unchecked Assignment
warning... but why? Won't all of A
's lists be of type <? extends I>
? b.list always has elements that extend I, so I am having trouble seeing why there would be an error