Fix serialization of Cluster.
We can no longer rely on the ability to reflectively access the private members of java.awt.Rectangle. Modern JVMs are stricter about enforcing cross-module private access. Prudes.
This commit is contained in:
@@ -22,9 +22,12 @@
|
||||
package com.threerings.whirled.spot.data;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.util.ActionScript;
|
||||
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
@@ -48,6 +51,31 @@ public class Cluster extends Rectangle
|
||||
return _key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes our streamable fields. This is needed because we can no longer reflectively access the
|
||||
* internals of java.awt.Rectangle.
|
||||
*/
|
||||
public void writeObject (ObjectOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
out.writeInt(this.x);
|
||||
out.writeInt(this.y);
|
||||
out.writeInt(this.width);
|
||||
out.writeInt(this.height);
|
||||
out.writeInt(this.clusterOid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads our streamable fields. This is needed because we can no longer reflectively access the
|
||||
* internals of java.awt.Rectangle.
|
||||
*/
|
||||
public void readObject (ObjectInputStream in)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
this.setBounds(in.readInt(), in.readInt(), in.readInt(), in.readInt());
|
||||
this.clusterOid = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionScript(omit=true)
|
||||
public boolean equals (Object other)
|
||||
|
||||
Reference in New Issue
Block a user