diff options
| author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-09 02:56:38 +0000 |
|---|---|---|
| committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-09 02:56:38 +0000 |
| commit | 8cc2e82455f265d2664f4aa786e85bce34195919 (patch) | |
| tree | 69de4af6d48ae5e4075714c8cdaa85fdc622abe4 /libjava/java/lang/Integer.java | |
| parent | 95e4499f5b9dc067678b1fb219edc11aadfedc4a (diff) | |
| download | gcc-8cc2e82455f265d2664f4aa786e85bce34195919.tar.gz | |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39556 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang/Integer.java')
| -rw-r--r-- | libjava/java/lang/Integer.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libjava/java/lang/Integer.java b/libjava/java/lang/Integer.java index 163c8501515..2cf7bb45349 100644 --- a/libjava/java/lang/Integer.java +++ b/libjava/java/lang/Integer.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation This file is part of libgcj. @@ -86,11 +86,9 @@ public final class Integer extends Number implements Comparable } // 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); } @@ -101,7 +99,7 @@ public final class Integer extends Number implements Comparable 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. @@ -140,8 +138,7 @@ public final class Integer extends Number implements Comparable 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) @@ -181,7 +178,7 @@ public final class Integer extends Number implements Comparable { 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(); |
