From c049d66c54c4f255bc0de70b2fd4ec559df7ebcd Mon Sep 17 00:00:00 2001 From: Vinicius Miana Date: Fri, 8 Feb 2013 19:00:21 -0200 Subject: SI-6935 Added readResolve in BoxedUnit When deserializing Unit, it would return an instance of Object, but not a Scala Unit. By adding readResolve, the deserialization of Unit will work. --- test/files/run/t6935.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/files/run/t6935.scala (limited to 'test/files/run') diff --git a/test/files/run/t6935.scala b/test/files/run/t6935.scala new file mode 100644 index 0000000000..dea2d7f2e2 --- /dev/null +++ b/test/files/run/t6935.scala @@ -0,0 +1,14 @@ +object Test { + + def main(args: Array[String]): Unit = { + import java.io._ + val bytes = new ByteArrayOutputStream() + val out = new ObjectOutputStream(bytes) + out.writeObject(()) + out.close() + val buf = bytes.toByteArray + val in = new ObjectInputStream(new ByteArrayInputStream(buf)) + val unit = in.readObject() + assert(unit == ()) + } +} -- cgit v1.2.3