On 06/19/2013 10:38 PM, Kurchi Hazra wrote:
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/>

Your changes to hashCode are in line with what the equals method is doing. So, they look fine to me.

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());
      }

D'oh!


      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?

It probably should go through the awt forest, but since the scope is limited I see no problem running it through TL.

-Chris.


If this discussion belongs elsewhere, let me know.

Thanks for your help,
- Kurchi

Reply via email to