File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
src/library/scala/runtime Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ public final class BoxedUnit implements java.io.Serializable {
17
17
public final static BoxedUnit UNIT = new BoxedUnit ();
18
18
19
19
public final static Class <Void > TYPE = java .lang .Void .TYPE ;
20
+
21
+ private Object readResolve () { return UNIT ; }
20
22
21
23
private BoxedUnit () { }
22
24
Original file line number Diff line number Diff line change
1
+ object Test {
2
+
3
+ def main (args : Array [String ]): Unit = {
4
+ import java .io ._
5
+ val bytes = new ByteArrayOutputStream ()
6
+ val out = new ObjectOutputStream (bytes)
7
+ out.writeObject(())
8
+ out.close()
9
+ val buf = bytes.toByteArray
10
+ val in = new ObjectInputStream (new ByteArrayInputStream (buf))
11
+ val unit = in.readObject()
12
+ assert(unit == ())
13
+ }
14
+ }
You can’t perform that action at this time.
0 commit comments