minor java.util.TreeMap bug
Archie Cobbs
archie at whistle.com
Mon Sep 25 11:35:28 PDT 2000
Timothy Stack writes:
> I don't know if this is a real bug or not, but in java.util.TreeMap
> there's this line in deleteNode:
>
> 325: x.parent = y.parent;
>
> The problem is that x can be NIL which is a global variable, which seems
> bad. One might think a quick fix would be to test for NIL and not set the
> parent, but this causes more grief because the other functions reference
> parent without checking if its non-nil. Probably not a big problem, just
> thought i'd let you know.
I think this is OK because NIL.parent is never actually used.
I haven't verified this rigourously but it makes sense if you
think about it, because NIL is the child of all leaf nodes, so
NIL has many actual parents.
-Archie
___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com
More information about the kaffe
mailing list