This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
TreeMap.clone (yet again)
- To: java-patches at sources dot redhat dot com
- Subject: TreeMap.clone (yet again)
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Fri, 16 Feb 2001 15:32:02 +1300
I'm pretty sure we have it right this time ;-)
2001-02-16 Bryce McKinlay <bryce@albatross.co.nz>
* java/util/TreeMap.java (nil): Made non-final.
(clone): Create new nil node for copy.
Index: java/util/TreeMap.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/util/TreeMap.java,v
retrieving revision 1.3
diff -u -r1.3 TreeMap.java
--- TreeMap.java 2001/02/16 01:49:40 1.3
+++ TreeMap.java 2001/02/16 02:23:27
@@ -67,7 +67,7 @@
/** Sentinal node, used to avoid null checks for corner cases and
make the
delete rebalance code simpler. Note that this must not be
static, due
to thread-safety concerns. */
- transient final Node nil = new Node(null, null);
+ transient Node nil = new Node(null, null);
/** The root node of this TreeMap */
transient Node root = nil;
@@ -186,6 +186,8 @@
catch (CloneNotSupportedException x)
{
}
+ // Each instance must have a unique sentinal.
+ copy.nil = new Node(null, null);
copy.fabricateTree(size);
Node node = firstNode();