Whoops, clone should obtain the uninitialized cloned object via

super.clone() so that it is of the appropriate derived class. I must have
picked a bad week to stop sniffing glue.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1781 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-10-06 20:24:53 +00:00
parent 061c73c64e
commit 893e3d3aa0
@@ -1,5 +1,5 @@
// //
// $Id: DSet.java,v 1.19 2002/08/14 23:52:15 mdb Exp $ // $Id: DSet.java,v 1.20 2002/10/06 20:24:53 mdb Exp $
package com.threerings.presents.dobj; package com.threerings.presents.dobj;
@@ -269,11 +269,15 @@ public class DSet
*/ */
public Object clone () public Object clone ()
{ {
DSet nset = new DSet(); try {
nset._entries = new Entry[_entries.length]; DSet nset = (DSet)super.clone();
System.arraycopy(_entries, 0, nset._entries, 0, _entries.length); nset._entries = new Entry[_entries.length];
nset._size = _size; System.arraycopy(_entries, 0, nset._entries, 0, _entries.length);
return nset; nset._size = _size;
return nset;
} catch (CloneNotSupportedException cnse) {
throw new RuntimeException("WTF? " + cnse);
}
} }
/** /**