I am trying to serialize a mutable PriorityQueue
in scala (2.10) and am getting a NotSerializableException
when writing the object to an ObjectOutputSt
This should be reported as a bug - the fix is to simply make the nested ResizableArrayAccess
class inherit Serializable
.
Technically, maybe you could use reflection to remove the private
and final
modifiers on the resarr
field in the priority queue class, then set it to null
before serialization.
Otherwise, converting the priority queue to a, say, array before serialization and vice versa on deserialization would avoid this exception. You could roll in your own wrapper around the PriorityQueue
to implement custom serialization/deserialization.
Note: This issue has been resolved in Scala 2.11.0-M7 (SI-7568)