Use of super in type parameters
daniel.smith at oracle.com
Thu Apr 18 09:33:08 PDT 2013
On Apr 17, 2013, at 6:11 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:
> On Wed, Apr 17, 2013 at 4:53 PM, Martin Buchholz <martinrb at google.com> wrote:
>> With the coming of lambda, it is more likely that people will be creating
>> APIs with "not quite correct" generic types, as we are doing in
> I believe that we can tweak generic signatures in APIs without
> breaking calling codes.
It's one thing to make a change that won't break callers. It's another to make a change that won't break implementers.
> <S super T> foo(List<S>, List<S>)
> but we declare it today as, regrettably,
> foo(List<? super T>, List<? super T>)
Unfortunately (without some sort of language change...), neither one of these signatures can be used to override the other. So if somebody extends my class and overrides my signature, when I change it to the other one later, their code will break.
More information about the lambda-dev