java.lang.Integer.compareTo(null) should throw NPE. It should be described in the javadoc spec.
In fact Integer.compareTo(null) throws null. To reproduce it you may run following test:
public class Test {
public static void main(String[] args) {
new Integer(3).compareTo(null);
}
}
----
the result is:
Exception in thread "main" java.lang.NullPointerException
...
###@###.### 2005-03-24 10:47:23 GMT
In fact Integer.compareTo(null) throws null. To reproduce it you may run following test:
public class Test {
public static void main(String[] args) {
new Integer(3).compareTo(null);
}
}
----
the result is:
Exception in thread "main" java.lang.NullPointerException
...
###@###.### 2005-03-24 10:47:23 GMT
- relates to
-
JDK-6245436 (spec) Comparable.compareTo(null) should document behavior on null input
-
- Closed
-