summaryrefslogtreecommitdiff
path: root/test/files/run/t6935.scala
diff options
context:
space:
mode:
authorVinicius Miana <vinicius@miana.com.br>2013-02-08 19:00:21 -0200
committerVinicius Miana <vinicius@miana.com.br>2013-02-08 19:09:00 -0200
commitc049d66c54c4f255bc0de70b2fd4ec559df7ebcd (patch)
tree0d64e514307ad5fb10a56edb56d4f8cc31f89733 /test/files/run/t6935.scala
parent6537d79e47def868e028815db6f70e2dc7d49bac (diff)
downloadscala-c049d66c54c4f255bc0de70b2fd4ec559df7ebcd.tar.gz
scala-c049d66c54c4f255bc0de70b2fd4ec559df7ebcd.tar.bz2
scala-c049d66c54c4f255bc0de70b2fd4ec559df7ebcd.zip
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.
Diffstat (limited to 'test/files/run/t6935.scala')
-rw-r--r--test/files/run/t6935.scala14
1 files changed, 14 insertions, 0 deletions
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 == ())
+ }
+}