diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-11-30 15:38:56 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-11-30 15:38:56 +0000 |
commit | 4be5e11cccace4974ed9a449052455392570139f (patch) | |
tree | 88c86bc65b88df08b48584ed791acd1619983c0c /test/files/run | |
parent | 402d96dd3fab6ae677966a9a258c00b3f34a37ed (diff) | |
download | scala-4be5e11cccace4974ed9a449052455392570139f.tar.gz scala-4be5e11cccace4974ed9a449052455392570139f.tar.bz2 scala-4be5e11cccace4974ed9a449052455392570139f.zip |
Deprecated the @serializable annotation, introd...
Deprecated the @serializable annotation, introduce a new trait
"scala.Serializable" which has to be extended instead (cross-platform).
Known issues:
- Companion objects of serializable classes (including case classes) are automatically made serializable. However, they don't extend "Serializable" statically because of the known difficulty (should be done before typing, but hard).
- Writing "case class C() extends Serializable" gives "error: trait Serializable is inherited twice"
- Functions are serializable, but don't extend Serializable dynamically (could be fixed by making FunctionN Serializable - shouldn't we?)
Note that @SerialVersionUID continues to be an annotation; it generates
a static field, which is not possible otherwise in scala.
Review by dragos, extempore.
Question to dragos: in JavaPlatform.isMaybeBoxed, why is there a test
for "JavaSerializableClass"? Is that correct?
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t3667.check | 3 | ||||
-rw-r--r-- | test/files/run/t3667.scala | 31 |
2 files changed, 34 insertions, 0 deletions
diff --git a/test/files/run/t3667.check b/test/files/run/t3667.check index 01e79c32a8..bbe5d1bc48 100644 --- a/test/files/run/t3667.check +++ b/test/files/run/t3667.check @@ -1,3 +1,6 @@ 1 2 3 +4 +2 +3 diff --git a/test/files/run/t3667.scala b/test/files/run/t3667.scala index 7bd0b4ec5e..f30d57ce3a 100644 --- a/test/files/run/t3667.scala +++ b/test/files/run/t3667.scala @@ -3,6 +3,9 @@ object Test { val o1 = new Outer1 val o2 = new Outer2 val o3 = new Outer3 + val o4 = new Outer4 + val o5 = new Outer5 + val o6 = new Outer6 println(1) ser(new o1.Inner(1)) @@ -19,6 +22,21 @@ object Test { o3.Inner ser(new o3.Inner(1)) + println(4) + ser(new o4.Inner(1)) + o4.Inner + ser(new o4.Inner(1)) + + println(2) + ser(new o5.Inner(1)) + o5.Inner + ser(new o5.Inner(1)) + + println(3) + ser(new o6.Inner(1)) + o6.Inner + ser(new o6.Inner(1)) + foo } @@ -51,3 +69,16 @@ class Outer2 { class Outer3 { case class Inner(x: Int) } + + +class Outer4 extends Serializable { + class Inner(x: Int = 1) extends Serializable +} + +class Outer5 extends Serializable { + case class Inner(x: Int = 1) +} + +class Outer6 extends Serializable { + case class Inner(x: Int) +} |