[OpenJDK 2D-Dev] 8017109: Cleanup overrides warning in src/solaris/classes/sun/print/AttributeClass.java

Kurchi Hazra kurchi.subhra.hazra at oracle.com
Wed Jun 19 21:38:45 UTC 2013


Hi,

   The class src/solaris/classes/sun/print/AttributeClass.java overrides 
Object.equals() but not Object.hashCode() because of which
we get a warning everytime we build jdk8/tl. Here is a suggestion to 
remove the warning:

http://cr.openjdk.java.net/~khazra/8017109/webrev.00/ 
<http://cr.openjdk.java.net/%7Ekhazra/8017109/webrev.00/>

I was also wondering whether the implementation of the equals() method 
is correct, and whether it is instead meant to be:

diff -r eb1a3c50a2a9 src/solaris/classes/sun/print/AttributeClass.java
--- a/src/solaris/classes/sun/print/AttributeClass.java Tue Jun 18 
14:11:45 2013 -0700
+++ b/src/solaris/classes/sun/print/AttributeClass.java Wed Jun 19 
14:20:27 2013 -0700
@@ -250,9 +250,8 @@

      public boolean equals(Object obj) {
          return
-            obj != null &&
              obj instanceof AttributeClass &&
-            obj.toString().equals (((AttributeClass) obj).toString());
+            toString().equals (((AttributeClass) obj).toString());
      }

      public String toString() {

What is the preferable way of getting this change into the code - I can 
push via tl. What are the tests I would need to run?

If this discussion belongs elsewhere, let me know.

Thanks for your help,
- Kurchi



More information about the 2d-dev mailing list