Re:Java Generics FAQs
by taeric on Friday April 17, 2015 @09:57AM
(#9394291)
In the example case, though, it isn't about giving it a name. It is about using the name in the first place. Is no different from:
Note that if that were instead:
Then things work, because the subtyping is chosen. In the generics case, there is no relation between Foo<Number> and Foo<Integer>. If there were, then the capture could potentially treat Foo<?> as Foo<Object> and then depending on if you went co or contra, could allow the call.
[ Parent
| on HN ]
There are no comments on this comment yet.