diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/t3667.check | 3 | ||||
-rw-r--r-- | test/files/run/t3667.scala | 45 | ||||
-rw-r--r-- | test/files/scalap/packageObject/result.test | 1 | ||||
-rw-r--r-- | test/files/scalap/traitObject/result.test | 1 |
4 files changed, 50 insertions, 0 deletions
diff --git a/test/files/run/t3667.check b/test/files/run/t3667.check new file mode 100644 index 0000000000..01e79c32a8 --- /dev/null +++ b/test/files/run/t3667.check @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/test/files/run/t3667.scala b/test/files/run/t3667.scala new file mode 100644 index 0000000000..804432c516 --- /dev/null +++ b/test/files/run/t3667.scala @@ -0,0 +1,45 @@ +object Test { + def main(args: Array[String]) { + val o1 = new Outer1 + val o2 = new Outer2 + val o3 = new Outer3 + + println(1) + ser(new o1.Inner(1)) + o1.Inner // make sure the Inner$module field of the Outer1 instance is initialized! + ser(new o1.Inner(1)) + + println(2) + ser(new o2.Inner(1)) + o2.Inner + ser(new o2.Inner(1)) + + println(3) + ser(new o3.Inner(1)) + o3.Inner + ser(new o3.Inner(1)) + } + + def ser(o: AnyRef) { + val oos = new java.io.ObjectOutputStream(new java.io.ByteArrayOutputStream()) + oos.writeObject(o) + oos.close() + } + +} + +@serializable +class Outer1 { + @serializable + class Inner(x: Int = 1) +} + +@serializable +class Outer2 { + case class Inner(x: Int = 1) +} + +@serializable +class Outer3 { + case class Inner(x: Int) +} diff --git a/test/files/scalap/packageObject/result.test b/test/files/scalap/packageObject/result.test index 6a8d6ae1d5..324992aae1 100644 --- a/test/files/scalap/packageObject/result.test +++ b/test/files/scalap/packageObject/result.test @@ -2,4 +2,5 @@ package object PackageObject extends java.lang.Object with scala.ScalaObject { def this() = { /* compiled code */ } type A = scala.Predef.String def foo(i : scala.Int) : scala.Int = { /* compiled code */ } + protected def readResolve() : java.lang.Object = { /* compiled code */ } } diff --git a/test/files/scalap/traitObject/result.test b/test/files/scalap/traitObject/result.test index 0d7de1535d..8978873fc7 100644 --- a/test/files/scalap/traitObject/result.test +++ b/test/files/scalap/traitObject/result.test @@ -5,4 +5,5 @@ trait TraitObject extends java.lang.Object with scala.ScalaObject { object TraitObject extends java.lang.Object with scala.ScalaObject { def this() = { /* compiled code */ } def bar : scala.Int = { /* compiled code */ } + protected def readResolve() : java.lang.Object = { /* compiled code */ } } |