is this possible? if not, why isn’t this possible in Java?
interface B extends A {}
public List<B> getList();
List<A> = getList(); // Type mismatch: cannot convert from List<B> to List<A>
I think the topic I’m looking for is “covariant types” as here and here, but its murky and it doesn’t solve my problem.
Here is an intuitive example of how this can make things go horribly wrong: