diff options
author | Stefan Zeiger <szeiger@novocode.com> | 2011-12-02 15:57:54 +0100 |
---|---|---|
committer | Stefan Zeiger <szeiger@novocode.com> | 2011-12-02 15:57:54 +0100 |
commit | 66b6ad4cacf69df95499b29f49d03a7e963a9eb9 (patch) | |
tree | 455d6e7ce3f4a04ed81f289582ee141bf9c2b048 /test/files | |
parent | 0f87b7b5780267d05d467a2f0075ee746f2cef2f (diff) | |
download | scala-66b6ad4cacf69df95499b29f49d03a7e963a9eb9.tar.gz scala-66b6ad4cacf69df95499b29f49d03a7e963a9eb9.tar.bz2 scala-66b6ad4cacf69df95499b29f49d03a7e963a9eb9.zip |
Make Enumeration.ValueSet Serializable
Closes SI-5117.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/enums.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/files/run/enums.scala b/test/files/run/enums.scala index 8c6c88ea07..9cdeed2691 100644 --- a/test/files/run/enums.scala +++ b/test/files/run/enums.scala @@ -94,6 +94,29 @@ object Test5 { } } +object SerializationTest { + object Types extends Enumeration { val X, Y = Value } + class A extends java.io.Serializable { val types = Types.values } + class B extends java.io.Serializable { val types = Set(Types.X, Types.Y) } + + def serialize(obj: AnyRef) = { + val baos = new java.io.ByteArrayOutputStream() + val oos = new java.io.ObjectOutputStream(baos) + oos.writeObject(obj) + oos.close() + val bais = new java.io.ByteArrayInputStream(baos.toByteArray) + val ois = new java.io.ObjectInputStream(bais) + val prime = ois.readObject() + ois.close() + prime + } + + def run { + serialize(new B()) + serialize(new A()) + } +} + //############################################################################ // Test code @@ -125,6 +148,7 @@ object Test { Console.println; Test5.run; Console.println; + SerializationTest.run; } } |