diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2008-03-21 20:33:37 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2008-03-21 20:33:37 +0000 |
commit | c0705fc670b40710d7dc22010c5d0b2a0c21e634 (patch) | |
tree | b241678cbf829c6bf5c690813c2189d956768b32 /src | |
parent | 1eaa352ec880ce4186c53760d42a0e5f7e08e18a (diff) | |
download | scala-c0705fc670b40710d7dc22010c5d0b2a0c21e634.tar.gz scala-c0705fc670b40710d7dc22010c5d0b2a0c21e634.tar.bz2 scala-c0705fc670b40710d7dc22010c5d0b2a0c21e634.zip |
Fixed issue #668, removed fix for issue #602.
Diffstat (limited to 'src')
-rw-r--r-- | src/cldc-library/scala/runtime/BoxesRunTime.java | 34 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxesRunTime.java | 34 |
2 files changed, 68 insertions, 0 deletions
diff --git a/src/cldc-library/scala/runtime/BoxesRunTime.java b/src/cldc-library/scala/runtime/BoxesRunTime.java index 33c418381a..9374f6bce6 100644 --- a/src/cldc-library/scala/runtime/BoxesRunTime.java +++ b/src/cldc-library/scala/runtime/BoxesRunTime.java @@ -127,6 +127,39 @@ public class BoxesRunTime { /* UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING */ public static boolean unboxToBoolean(Object b) { + return b == null ? false : ((Boolean)b).booleanValue(); + } + + public static char unboxToChar(Object c) { + return c == null ? 0 : ((Character)c).charValue(); + } + + public static byte unboxToByte(Object b) { + return b == null ? 0 : ((Byte)b).byteValue(); + } + + public static short unboxToShort(Object s) { + return s == null ? 0 : ((Short)s).shortValue(); + } + + public static int unboxToInt(Object i) { + return i == null ? 0 : ((Integer)i).intValue(); + } + + public static long unboxToLong(Object l) { + return l == null ? 0 : ((Long)l).longValue(); + } + + public static float unboxToFloat(Object f) { + return f == null ? 0.0f : ((Float)f).floatValue(); + } + + public static double unboxToDouble(Object d) { + return d == null ? 0.0d : ((Double)d).doubleValue(); + } + + /* + public static boolean unboxToBoolean(Object b) { if (b == null) throw new ClassCastException("null is no Boolean value"); return ((Boolean)b).booleanValue(); @@ -161,6 +194,7 @@ public class BoxesRunTime { throw new ClassCastException("null is no Long value"); return ((Long)l).longValue(); } + */ /* COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON */ diff --git a/src/library/scala/runtime/BoxesRunTime.java b/src/library/scala/runtime/BoxesRunTime.java index 932c530901..a8e0549449 100644 --- a/src/library/scala/runtime/BoxesRunTime.java +++ b/src/library/scala/runtime/BoxesRunTime.java @@ -135,6 +135,39 @@ public class BoxesRunTime { /* UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING */ public static boolean unboxToBoolean(Object b) { + return b == null ? false : ((Boolean)b).booleanValue(); + } + + public static char unboxToChar(Object c) { + return c == null ? 0 : ((Character)c).charValue(); + } + + public static byte unboxToByte(Object b) { + return b == null ? 0 : ((Byte)b).byteValue(); + } + + public static short unboxToShort(Object s) { + return s == null ? 0 : ((Short)s).shortValue(); + } + + public static int unboxToInt(Object i) { + return i == null ? 0 : ((Integer)i).intValue(); + } + + public static long unboxToLong(Object l) { + return l == null ? 0 : ((Long)l).longValue(); + } + + public static float unboxToFloat(Object f) { + return f == null ? 0.0f : ((Float)f).floatValue(); + } + + public static double unboxToDouble(Object d) { + return d == null ? 0.0d : ((Double)d).doubleValue(); + } + + /* + public static boolean unboxToBoolean(Object b) { if (b == null) throw new ClassCastException("null is no Boolean value"); return ((Boolean)b).booleanValue(); @@ -181,6 +214,7 @@ public class BoxesRunTime { throw new ClassCastException("null is no Double value"); return ((Double)d).doubleValue(); } + */ /* COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON */ |