summaryrefslogtreecommitdiff
path: root/test/files/jvm/t1116.scala
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2008-08-03 15:09:09 +0000
committerPhilipp Haller <hallerp@gmail.com>2008-08-03 15:09:09 +0000
commit70f7bb2dc10a2ebd1f9a4e447be54a3b0f709673 (patch)
tree69740d107efb0a246c584527b018261f892f59e8 /test/files/jvm/t1116.scala
parent8b067247579787aacc7d851ca597c3a3bc818641 (diff)
downloadscala-70f7bb2dc10a2ebd1f9a4e447be54a3b0f709673.tar.gz
scala-70f7bb2dc10a2ebd1f9a4e447be54a3b0f709673.tar.bz2
scala-70f7bb2dc10a2ebd1f9a4e447be54a3b0f709673.zip
Moved tests from jvm5 to jvm.
Diffstat (limited to 'test/files/jvm/t1116.scala')
-rw-r--r--test/files/jvm/t1116.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/files/jvm/t1116.scala b/test/files/jvm/t1116.scala
new file mode 100644
index 0000000000..023e5b3a02
--- /dev/null
+++ b/test/files/jvm/t1116.scala
@@ -0,0 +1,27 @@
+object Serialize {
+ @throws(classOf[java.io.IOException])
+ def write[A](o: A): Array[Byte] = {
+ val ba = new java.io.ByteArrayOutputStream(512)
+ val out = new java.io.ObjectOutputStream(ba)
+ out.writeObject(o)
+ out.close()
+ ba.toByteArray()
+ }
+ @throws(classOf[java.io.IOException])
+ @throws(classOf[ClassNotFoundException])
+ def read[A](buffer: Array[Byte]): A = {
+ val in =
+ new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer))
+ in.readObject().asInstanceOf[A]
+ }
+}
+
+object Foo {
+ def obj_foo(x: Int) = { () => x }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ Serialize.write(Foo.obj_foo(3))
+ }
+}