LinkedList facelift
Martin Buchholz
martinrb at google.com
Tue Nov 3 19:32:06 UTC 2009
On Tue, Nov 3, 2009 at 01:06, Rémi Forax <forax at univ-mlv.fr> wrote:
> Hi Martin,
> Your patch can break backward compat.
>
> add(E) now delegates to a public method (an overridable one)
> (addLast). So If I have a class that inherits from LinkedList
> and overrides addLast() the current semantics of add(E) is not altered,
> with your patch, add(E) semantics is also changed.
>
> I think the code of addLast() should be in a private method and
> addLast() and add(E) delegate to it.
>
>
Rémi, thanks for the review. I've added you as a reviewer.
I agree. Although relying on such implementation details is a bad idea,
and implementations are very likely to differ, and the existing LinkedList
is a hodge-podge of differing styles of methods calling other public
methods, we should strive to maintain this kind of compatibility if
the price is not too high.
Also, I did some cosmetic touchups, and commented out the asserts.
Webrev regenerated.
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20091103/8ca1deb0/attachment.html>
More information about the core-libs-dev
mailing list