With all respect I think you've missed the point of the article. Of course it does not apply to Lists, since they both produce and consume objects. It could apply to immutable lists, where you cannot add/set items, only get.
My point was to show that classes with generic types that are used in producer role are not detected by Java compiler as safe to cast, when covariant types are used.
I see. Thanks for the clarification. I'm still not sure that this technique is really safe and won't be abused in some very unobvious ways, but that's completely different story. :)
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.