blob: 29edaa325fb1837f21aa96722cdf3b1bea4047f2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2005, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.runtime.types;
import scala.runtime.RunTime;
import scala.Type;
import scala.Array;
import scala.Unit;
public class TypeUnit extends ValueType {
private final Unit ZERO = RunTime.box_uvalue();
public Object cast(Object o) {
assert scala.runtime.types.Statistics.incTypeCast();
if (! (o == null || o instanceof scala.Unit))
throw new ClassCastException(); // TODO error message
return o;
}
public Object defaultValue() { return ZERO; }
public boolean isSameAsJavaType(Class that) {
return that == java.lang.Void.TYPE;
}
public String toString() { return "scala.Unit"; }
public int hashCode() { return 0x99999999; }
// Make TypeUnit a serializable singleton
public static TypeUnit INSTANCE = new TypeUnit();
protected TypeUnit() { /* exists only to that instantiation */ }
private Object readResolve() { return INSTANCE; }
}
|