Ugh. So I keep forgetting that Java generics aren’t covariant (can’t pass List<Square>
where List<Shape>
is expected). I understand why that’s the case but maybe they should have come up with a different name, something that captures how they mostly do what you want, until they surprise you. While I like them for clarifying API design and documentation, they seem to be fixing a type safety problem I rarely encountered.