* java/lang/Byte.java: Remove redundant instanceof and null checks.
* java/lang/Integer.java: Likewise.
* java/lang/Long.java: Likewise.
* java/lang/Short.java: Likewise.
* java/lang/Double.java: Likewise.
(doubleToRawLongBits): New method.
* java/lang/Float.java: As above.
(floatToRawIntBits): New method.
From-SVN: r39556
+2001-02-08 Bryce McKinlay <bryce@albatross.co.nz>
+
+ * java/lang/Byte.java: Remove redundant instanceof and null checks.
+ * java/lang/Integer.java: Likewise.
+ * java/lang/Long.java: Likewise.
+ * java/lang/Short.java: Likewise.
+ * java/lang/Double.java: Likewise.
+ (doubleToRawLongBits): New method.
+ * java/lang/Float.java: As above.
+ (floatToRawIntBits): New method.
+
2001-02-08 Tom Tromey <tromey@redhat.com>
* java/lang/Float.java (parseFloat): New method.
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
}
// Added in JDK 1.2
- public int compareTo(Object o) throws ClassCastException
+ /** @throws ClassCastException */
+ public int compareTo(Object o)
{
- if (o instanceof Byte)
- return this.value - ((Byte) o).value;
- else
- throw new ClassCastException();
+ return this.value - ((Byte) o).value;
}
public boolean equals(Object obj)
{
- return obj != null && (obj instanceof Byte) && ((Byte)obj).value == value;
+ return (obj instanceof Byte) && ((Byte)obj).value == value;
}
// Verified that hashCode is returns plain value (see Boolean_1 test).
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
public boolean equals (Object obj)
{
- if (obj == null)
- return false;
-
if (!(obj instanceof Double))
return false;
return toString (v, false);
}
- public static Double valueOf (String s) throws NullPointerException,
- NumberFormatException
+ public static Double valueOf (String s) throws NumberFormatException
{
- if (s == null)
- throw new NullPointerException ();
-
return new Double (parseDouble (s));
}
public static native long doubleToLongBits (double value);
+ public static long doubleToRawLongBits (double value)
+ {
+ // FIXME: Check that this is correct with respect to NaN values.
+ return doubleToLongBits (value);
+ }
+
public static native double longBitsToDouble (long bits);
public int compareTo (Double d)
public boolean equals (Object obj)
{
- if (obj == null)
- return false;
-
if (!(obj instanceof Float))
return false;
return Double.toString ((double) v, true);
}
- public static Float valueOf (String s) throws NullPointerException,
- NumberFormatException
+ public static Float valueOf (String s) throws NumberFormatException
{
- if (s == null)
- throw new NullPointerException ();
-
return new Float (Double.valueOf (s).floatValue ());
}
}
public static native int floatToIntBits (float value);
+
+ public static int floatToRawIntBits (float value)
+ {
+ // FIXME: Is this supposed to be different? NaN values seem to be handled
+ // the same in the JDK.
+ return floatToIntBits (value);
+ }
public static native float intBitsToFloat (int bits);
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
}
// Added in JDK 1.2
- public int compareTo(Object o) throws ClassCastException
+ /** @throws ClassCastException */
+ public int compareTo(Object o)
{
- if (!(o instanceof Integer))
- throw new ClassCastException();
-
return this.compareTo((Integer) o);
}
int radix = 10;
final int len;
- if (str == null || (len = str.length()) == 0)
+ if ((len = str.length()) == 0)
throw new NumberFormatException();
// Negative numbers are always radix 10.
public boolean equals(Object obj)
{
- return (obj != null && (obj instanceof Integer)
- && ((Integer) obj).value == value);
+ return (obj instanceof Integer && ((Integer) obj).value == value);
}
public static Integer getInteger(String prop)
{
final int len;
- if (str == null || (len = str.length()) == 0 ||
+ if ((len = str.length()) == 0 ||
radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
throw new NumberFormatException();
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
}
// Added in JDK 1.2
- public int compareTo(Object o) throws ClassCastException
+ /** @throws ClassCastException */
+ public int compareTo(Object o)
{
- if (!(o instanceof Long))
- throw new ClassCastException();
-
return this.compareTo((Long) o);
}
int radix = 10;
final int len;
- if (str == null || (len = str.length()) == 0)
+ if ((len = str.length()) == 0)
throw new NumberFormatException();
// Negative numbers are always radix 10.
public boolean equals(Object obj)
{
- return (obj != null && (obj instanceof Long)
- && ((Long) obj).value == value);
+ return (obj instanceof Long && ((Long) obj).value == value);
}
public static Long getLong(String prop)
{
final int len;
- if (str == null || (len = str.length()) == 0 ||
- radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
+ if ((len = str.length()) == 0 || radix < Character.MIN_RADIX
+ || radix > Character.MAX_RADIX)
throw new NumberFormatException();
boolean isNeg = false;
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
}
// Added in JDK 1.2
- public int compareTo(Object o) throws ClassCastException
+ /** @throws ClassCastException */
+ public int compareTo(Object o)
{
- if (o instanceof Short)
- return this.value - ((Short) o).value;
- else
- throw new ClassCastException();
+ return this.value - ((Short) o).value;
}
public boolean equals(Object obj)
{
- return (obj != null && (obj instanceof Short)
- && ((Short) obj).value == value);
+ return (obj instanceof Short) && ((Short) obj).value == value;
}
// Verified that hashCode is returns plain value (see Short_1 test).