summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRex Kerr <ichoran@gmail.com>2015-03-31 10:38:13 -0700
committerRex Kerr <ichoran@gmail.com>2015-03-31 14:12:03 -0700
commit342e71e1cfc676091b9a1519fe7a9ab8d00eec9d (patch)
tree2ba7f10f8b71a0458eb96f61432e9745abc96ad5
parent8108ed6b4efe4d82cfe949205607c2a1167f312b (diff)
downloadscala-342e71e1cfc676091b9a1519fe7a9ab8d00eec9d.tar.gz
scala-342e71e1cfc676091b9a1519fe7a9ab8d00eec9d.tar.bz2
scala-342e71e1cfc676091b9a1519fe7a9ab8d00eec9d.zip
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.
-rw-r--r--src/library/scala/collection/immutable/List.scala2
1 files changed, 2 insertions, 0 deletions
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 =>