If no map class is passed in (should only happen on deserialization, and the real source map is provided on readObject), pass an empty immutable map to super, which is less weird and probably better than just ignoring and forcibly not calling the super constructor, which is what was happening.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6105 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -27,6 +27,8 @@ import com.threerings.io.Streamable;
|
||||
|
||||
import com.threerings.util.Maps;
|
||||
import com.threerings.util.maps.ForwardingMap;
|
||||
import com.threerings.util.maps.HashMap;
|
||||
import com.threerings.util.maps.ImmutableMap;
|
||||
|
||||
/**
|
||||
* A Map that can be sent over the wire, bearing in mind that all keys and values must
|
||||
@@ -40,9 +42,7 @@ public class StreamableHashMap extends ForwardingMap
|
||||
{
|
||||
public function StreamableHashMap (keyClazz :Class = null)
|
||||
{
|
||||
if (keyClazz != null) {
|
||||
super(Maps.newMapOf(keyClazz));
|
||||
}
|
||||
super(keyClazz == null ? DEFAULT_MAP : Maps.newMapOf(keyClazz));
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
@@ -73,5 +73,7 @@ public class StreamableHashMap extends ForwardingMap
|
||||
_source = Maps.newMapOf(String); // hope for the best
|
||||
}
|
||||
}
|
||||
|
||||
protected static const DEFAULT_MAP :Map = new ImmutableMap(new HashMap());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user