Closed JimN-LiveAction closed 4 years ago
I see a very similar problem for TreePVector
:
Exception in thread "main" java.io.NotSerializableException: org.pcollections.IntTreePMap$1
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
This is failing with a vector of our application objects (of size 4). I tried to make a reproducible test case with simple objects (i.e., Integer
) but can't reproduce. Not being familiar with pcollections internals, I don't know if the issue is caused by the order/structure of construction or somehow data related such as dependent on Object.hashCode()
.
FWIW org.pcollections.IntTreePMap$1
is probably the first anonymous class and the proper fix is probably making the field transient.
Thanks for the report! I reproduced the error, putting together a fix now…
Committed a fix. You were right about the need for transient
, and in fact I fixed almost this exact bug a year ago in 01f38f9 🤦♂️ …this time however I searched for other similar cache variables and found none, so hopefully that's the last of this particular bug.
I'm pushing a new maven release now, usually takes like 6 hours to propagate for some reason.
Fix is live in v3.1.1
Thanks again for the report and solution!
I verified this issue is fixed for me. Thanks for the extremely quick resolution and patch release!
HashTreePSet
is not serializable. Only tested onHashTreePSet.empty()
. Tested on pcollections 3.1.0.Simple test case:
Output: