Closed RustedBones closed 3 weeks ago
Did some digging and found the cause of the issue / resolution in scala 2.13 here
scala 2.12: case object have synthetic method readResolve
. This replaces the de-serialized object with the singleton instance. However, the de-serialization of the original object fails before the replacement. Indeed, a Serializable class must have access to the no-arg constructor of its first non-serializable superclass.
scala 2.13: case object have synthetic method writeReplace
and uses a proxy to de-serialize the object to return the singleton instance. No failure here.
right... fundamentally a duplicate of #10412 , I think? though the failure mode is different. in any case, closing since it's fixed as of 2.13.0 and we don't keep 2.12-only tickets open
when declaring case objects that extends
class
instead oftrait
, serialization fails with scala 2.12. case objects are supposed to be serializable.Reproduction steps
Scala version:
2.12.19
(also testing on2.12.x
scala branch)Added the test from
scala/2.12.x
branch: diffProblem
The test fails with