From 342e71e1cfc676091b9a1519fe7a9ab8d00eec9d Mon Sep 17 00:00:00 2001 From: Rex Kerr Date: Tue, 31 Mar 2015 10:38:13 -0700 Subject: SI-8254 List SerializationProxy fails to default(Read/Write)Object Added `defaultWriteObject` to the beginning of `writeObject` and `defaultReadObject` to the beginning of `readObject` as required by specs: [writing](http://docs.oracle.com/javase/6/docs/platform/serialization/spec/output.html#861), [reading](http://docs.oracle.com/javase/6/docs/platform/serialization/spec/input.html#2971). Verified that it is a no-op in terms of serialization stream (but it provides hooks that Infinispan and others may use). No explicit tests. If there is a change in serialization, t8549 will catch it. --- src/library/scala/collection/immutable/List.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index 254f14f13c..82e38d3549 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -462,6 +462,7 @@ object List extends SeqFactory[List] { private class SerializationProxy[A](@transient private var orig: List[A]) extends Serializable { private def writeObject(out: ObjectOutputStream) { + out.defaultWriteObject() var xs: List[A] = orig while (!xs.isEmpty) { out.writeObject(xs.head) @@ -473,6 +474,7 @@ object List extends SeqFactory[List] { // Java serialization calls this before readResolve during de-serialization. // Read the whole list and store it in `orig`. private def readObject(in: ObjectInputStream) { + in.defaultReadObject() val builder = List.newBuilder[A] while (true) in.readObject match { case ListSerializeEnd => -- cgit v1.2.3