clone() modernization.

Apologies for the redundant cast warnings this is sure to introduce.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6015 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2010-01-13 18:19:48 +00:00
parent 3954ec5153
commit c4d132b232
4 changed files with 13 additions and 14 deletions
@@ -125,12 +125,12 @@ public class OccupantInfo extends SimpleStreamableObject
}
@Override
public Object clone ()
public OccupantInfo clone ()
{
try {
return super.clone();
return (OccupantInfo) super.clone();
} catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse);
throw new AssertionError(cnse);
}
}
}
@@ -74,12 +74,12 @@ public class ConMgrStats extends SimpleStreamableObject
public long msgsOut;
@Override // from Object
public Object clone ()
public ConMgrStats clone ()
{
try {
return super.clone();
return (ConMgrStats) super.clone();
} catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse);
throw new AssertionError(cnse);
}
}
}
@@ -438,7 +438,7 @@ public class DSet<E extends DSet.Entry>
nset._modCount = 0;
return nset;
} catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse);
throw new AssertionError(cnse);
}
}
@@ -446,7 +446,7 @@ public class DSet<E extends DSet.Entry>
* Generates a shallow copy of this object.
*/
@Override
public Object clone ()
public DSet<E> clone ()
{
return typedClone();
}
@@ -88,9 +88,7 @@ public class StreamableEnumSet<E extends Enum<E>> extends AbstractSet<E>
*/
public static <E extends Enum<E>> StreamableEnumSet<E> copyOf (StreamableEnumSet<E> s)
{
@SuppressWarnings("unchecked") StreamableEnumSet<E> set =
(StreamableEnumSet<E>)s.clone();
return set;
return s.clone();
}
/**
@@ -243,16 +241,17 @@ public class StreamableEnumSet<E extends Enum<E>> extends AbstractSet<E>
}
@Override // documentation inherited
public Object clone ()
public StreamableEnumSet<E> clone ()
{
try {
// make a deep clone of the contents
@SuppressWarnings("unchecked") StreamableEnumSet<E> cset = (StreamableEnumSet<E>)super.clone();
@SuppressWarnings("unchecked")
StreamableEnumSet<E> cset = (StreamableEnumSet<E>)super.clone();
cset._contents = _contents.clone();
return cset;
} catch (CloneNotSupportedException e) {
return null; // won't happen
throw new AssertionError(e); // won't happen
}
}