DSet.clone() has been modernized for a while now, rendering typedClone()
pointless. Let's deprecate it and auto-generate DObjects that just use clone(). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6028 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -427,8 +427,20 @@ public class DSet<E extends DSet.Entry>
|
||||
|
||||
/**
|
||||
* Generates a shallow copy of this object in a type safe manner.
|
||||
*
|
||||
* @deprecated clone() works just fine now.
|
||||
*/
|
||||
@Deprecated
|
||||
public DSet<E> typedClone ()
|
||||
{
|
||||
return clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a shallow copy of this object.
|
||||
*/
|
||||
@Override
|
||||
public DSet<E> clone ()
|
||||
{
|
||||
try {
|
||||
@SuppressWarnings("unchecked") DSet<E> nset = (DSet<E>)super.clone();
|
||||
@@ -442,15 +454,6 @@ public class DSet<E extends DSet.Entry>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a shallow copy of this object.
|
||||
*/
|
||||
@Override
|
||||
public DSet<E> clone ()
|
||||
{
|
||||
return typedClone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString ()
|
||||
{
|
||||
|
||||
@@ -191,9 +191,7 @@ public class GenUtil extends com.samskivert.util.GenUtil
|
||||
public static String cloneArgument (Class<?> dsclazz, Field field, String name)
|
||||
{
|
||||
Class<?> clazz = field.getType();
|
||||
if (dsclazz.equals(clazz)) {
|
||||
return "(" + name + " == null) ? null : " + name + ".typedClone()";
|
||||
} else if (clazz.isArray()) {
|
||||
if (clazz.isArray() || dsclazz.equals(clazz)) {
|
||||
return "(" + name + " == null) ? null : " + name + ".clone()";
|
||||
} else if (dsclazz.isAssignableFrom(clazz)) {
|
||||
return "(" + name + " == null) ? null : " +
|
||||
|
||||
Reference in New Issue
Block a user