summaryrefslogtreecommitdiff
path: root/src/cldc-library
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2008-03-20 14:56:41 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2008-03-20 14:56:41 +0000
commit75b4429e15e88c1b94407b8f1824861bf3125d14 (patch)
tree7498164d3e3b8c6631dcc354c5a799b3ed3360c9 /src/cldc-library
parent6854959bc237babd4012c6466cf9f89044cbb5c3 (diff)
downloadscala-75b4429e15e88c1b94407b8f1824861bf3125d14.tar.gz
scala-75b4429e15e88c1b94407b8f1824861bf3125d14.tar.bz2
scala-75b4429e15e88c1b94407b8f1824861bf3125d14.zip
Fixed issues #584 and #602.
Diffstat (limited to 'src/cldc-library')
-rw-r--r--src/cldc-library/scala/runtime/BoxesRunTime.java26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/cldc-library/scala/runtime/BoxesRunTime.java b/src/cldc-library/scala/runtime/BoxesRunTime.java
index 6d50c05627..33c418381a 100644
--- a/src/cldc-library/scala/runtime/BoxesRunTime.java
+++ b/src/cldc-library/scala/runtime/BoxesRunTime.java
@@ -127,27 +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();
+ if (b == null)
+ throw new ClassCastException("null is no Boolean value");
+ return ((Boolean)b).booleanValue();
}
public static char unboxToChar(Object c) {
- return c == null ? 0 : ((Character)c).charValue();
+ if (c == null)
+ throw new ClassCastException("null is no Char value");
+ return ((Character)c).charValue();
}
public static byte unboxToByte(Object b) {
- return b == null ? 0 : ((Byte)b).byteValue();
+ if (b == null)
+ throw new ClassCastException("null is no Byte value");
+ return ((Byte)b).byteValue();
}
public static short unboxToShort(Object s) {
- return s == null ? 0 : ((Short)s).shortValue();
+ if (s == null)
+ throw new ClassCastException("null is no Short value");
+ return ((Short)s).shortValue();
}
public static int unboxToInt(Object i) {
- return i == null ? 0 : ((Integer)i).intValue();
+ if (i == null)
+ throw new ClassCastException("null is no Int value");
+ return ((Integer)i).intValue();
}
public static long unboxToLong(Object l) {
- return l == null ? 0 : ((Long)l).longValue();
+ if (l == null)
+ throw new ClassCastException("null is no Long value");
+ return ((Long)l).longValue();
}
/* COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON */
@@ -192,7 +204,7 @@ public class BoxesRunTime {
}
/** arg1 - arg2 */
- public static Object substract(Object arg1, Object arg2) throws Error {
+ public static Object subtract(Object arg1, Object arg2) throws Error {
throw new Error();
}