At Ray's suggestion, go ahead and throw an error when the wrong type is read. Use the Type(obj) cast syntax (I was unaware that this would actually throw an error). Reading objects of a basic type like Array must still use "readObject(Array) as Array" so this is still supported, though not needed for user types.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5441 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2008-10-13 17:34:55 +00:00
parent 2b298aa3d5
commit 077c5e8053
17 changed files with 25 additions and 25 deletions
@@ -34,7 +34,7 @@ public class AuthResponse extends DownstreamMessage
override public function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_data = (ins.readObject(AuthResponseData) as AuthResponseData);
_data = AuthResponseData(ins.readObject());
}
protected var _data :AuthResponseData;
@@ -33,7 +33,7 @@ public class BootstrapNotification extends DownstreamMessage
override public function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_data = (ins.readObject(BootstrapData) as BootstrapData);
_data = BootstrapData(ins.readObject());
}
/** The data associated with this notification. */
@@ -57,7 +57,7 @@ public /* abstract */ class Credentials
public function readObject (ins :ObjectInputStream) :void
//throws IOError
{
_username = (ins.readObject(Name) as Name);
_username = Name(ins.readObject());
}
public function toString () :String
@@ -40,7 +40,7 @@ public class EventNotification extends DownstreamMessage
override public function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_event = (ins.readObject(DEvent) as DEvent);
_event = DEvent(ins.readObject());
}
/** The event which we are forwarding. */
@@ -40,7 +40,7 @@ public class ObjectResponse extends DownstreamMessage
override public function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_dobj = (ins.readObject(DObject) as DObject);
_dobj = DObject(ins.readObject());
}
/** The object which is associated with this response. */