Here is a simple test:
import java.awt.geom.Area;
import java.awt.Rectangle;
public class Test {
public static void main(String args[]) {
Area area = new Area(new Rectangle(10, 10));
if (area.equals(null)) {
System.err.println("?!");
}
}
}
#>JAVA_COMPILER=none /usr/local/java/jdk1.3/solaris/bin/java Test
Warning: JIT compiler "none" not found. Will use interpreter.
Exception in thread "main" java.lang.NullPointerException
at java.awt.geom.Area.equals(Area.java:321)
at Test.main(Test.java:8)
#>/usr/local/java/jdk1.3/solaris/bin/java -fullversion
java full version "JDK-1.3-H"
As Jim Graham has pointed out:
"While Area.equals(Area) isn't strictly required to follow the behavior
of Area.equals(Object), it probably should do so for a variety of reasons."
I believe that this is bug because w/o this method which overloads
Object.equals(Object) user would get 'false' instead of NPE and it's not very
useful for user to always insert 'try catch' block or check for null by
hiself while using Area.equals().
Anyways, this is not a big deal to fix this bug.
###@###.### 1999-06-11 ###@###.###
import java.awt.geom.Area;
import java.awt.Rectangle;
public class Test {
public static void main(String args[]) {
Area area = new Area(new Rectangle(10, 10));
if (area.equals(null)) {
System.err.println("?!");
}
}
}
#>JAVA_COMPILER=none /usr/local/java/jdk1.3/solaris/bin/java Test
Warning: JIT compiler "none" not found. Will use interpreter.
Exception in thread "main" java.lang.NullPointerException
at java.awt.geom.Area.equals(Area.java:321)
at Test.main(Test.java:8)
#>/usr/local/java/jdk1.3/solaris/bin/java -fullversion
java full version "JDK-1.3-H"
As Jim Graham has pointed out:
"While Area.equals(Area) isn't strictly required to follow the behavior
of Area.equals(Object), it probably should do so for a variety of reasons."
I believe that this is bug because w/o this method which overloads
Object.equals(Object) user would get 'false' instead of NPE and it's not very
useful for user to always insert 'try catch' block or check for null by
hiself while using Area.equals().
Anyways, this is not a big deal to fix this bug.
###@###.### 1999-06-11 ###@###.###