clone() modernization.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@872 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Ray Greenwell
2010-01-13 18:28:28 +00:00
parent a21a692f31
commit f0eaa44cab
6 changed files with 23 additions and 25 deletions
@@ -88,11 +88,10 @@ public abstract class ShaderConfig
} }
@Override // documentation inherited @Override // documentation inherited
public Object clone () public ShaderConfig clone ()
{ {
ShaderConfig other = null;
try { try {
other = (ShaderConfig)super.clone(); ShaderConfig other = (ShaderConfig)super.clone();
other._state = other._state =
DisplaySystem.getDisplaySystem().getRenderer().createGLSLShaderObjectsState(); DisplaySystem.getDisplaySystem().getRenderer().createGLSLShaderObjectsState();
other._state.setProgramID(_state.getProgramID()); other._state.setProgramID(_state.getProgramID());
@@ -112,10 +111,11 @@ public abstract class ShaderConfig
other._textures[ii] = (TextureConfig)_textures[ii].clone(); other._textures[ii] = (TextureConfig)_textures[ii].clone();
} }
} }
return other;
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
// will not happen throw new AssertionError(e);
} }
return other;
} }
/** /**
@@ -309,13 +309,12 @@ public abstract class ShaderConfig
} }
@Override // documentation inherited @Override // documentation inherited
public Object clone () public LightConfig clone ()
{ {
try { try {
return super.clone(); return (LightConfig) super.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
// will not happen throw new AssertionError(e);
return null;
} }
} }
@@ -341,13 +340,12 @@ public abstract class ShaderConfig
} }
@Override // documentation inherited @Override // documentation inherited
public Object clone () public TextureConfig clone ()
{ {
try { try {
return super.clone(); return (TextureConfig) super.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
// will not happen throw new AssertionError(e);
return null;
} }
} }
+2 -2
View File
@@ -135,12 +135,12 @@ public class Tile // implements Cloneable
// /** // /**
// * Creates a shallow copy of this tile object. // * Creates a shallow copy of this tile object.
// */ // */
// public Object clone () // public Tile clone ()
// { // {
// try { // try {
// return (Tile)super.clone(); // return (Tile)super.clone();
// } catch (CloneNotSupportedException cnse) { // } catch (CloneNotSupportedException cnse) {
// throw new RuntimeException(cnse); // throw new AssertionError(cnse);
// } // }
// } // }
@@ -112,12 +112,12 @@ public abstract class MisoSceneModel extends SimpleStreamableObject
public abstract boolean removeObject (ObjectInfo info); public abstract boolean removeObject (ObjectInfo info);
@Override @Override
public Object clone () public MisoSceneModel clone ()
{ {
try { try {
return super.clone(); return (MisoSceneModel) super.clone();
} catch (CloneNotSupportedException cnse) { } catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse); throw new AssertionError(cnse);
} }
} }
} }
@@ -166,12 +166,12 @@ public class ObjectInfo extends SimpleStreamableObject
} }
@Override @Override
public Object clone () public ObjectInfo clone ()
{ {
try { try {
return super.clone(); return (ObjectInfo) super.clone();
} catch (CloneNotSupportedException cnse) { } catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse); throw new AssertionError(cnse);
} }
} }
@@ -189,7 +189,7 @@ public class SimpleMisoSceneModel extends MisoSceneModel
} }
@Override @Override
public Object clone () public SimpleMisoSceneModel clone ()
{ {
SimpleMisoSceneModel model = (SimpleMisoSceneModel)super.clone(); SimpleMisoSceneModel model = (SimpleMisoSceneModel)super.clone();
model.baseTileIds = baseTileIds.clone(); model.baseTileIds = baseTileIds.clone();
@@ -226,7 +226,7 @@ public class SparseMisoSceneModel extends MisoSceneModel
} }
@Override @Override
public Object clone () { public Section clone () {
try { try {
Section section = (Section)super.clone(); Section section = (Section)super.clone();
section.baseTileIds = baseTileIds.clone(); section.baseTileIds = baseTileIds.clone();
@@ -236,7 +236,7 @@ public class SparseMisoSceneModel extends MisoSceneModel
section.objectInfo = objectInfo.clone(); section.objectInfo = objectInfo.clone();
return section; return section;
} catch (CloneNotSupportedException cnse) { } catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse); throw new AssertionError(cnse);
} }
} }
@@ -453,7 +453,7 @@ public class SparseMisoSceneModel extends MisoSceneModel
} }
@Override @Override
public Object clone () public SparseMisoSceneModel clone ()
{ {
SparseMisoSceneModel model = (SparseMisoSceneModel)super.clone(); SparseMisoSceneModel model = (SparseMisoSceneModel)super.clone();
model._sections = new StreamableHashIntMap<Section>(); model._sections = new StreamableHashIntMap<Section>();