Hi,

I am checking in the reimplementation of the equals method.


Marc, I can use your way with an additional null check if you
prefer ?


I think it is good to do it just in case one day in the future the will
be more subclasses. If that ever happens we will all have forgotten
about this little equals() method.

Cheers,

Mark

Regards,
Wolfgang

2005-12-19  Wolfgang Baer  <[EMAIL PROTECTED]>

        * javax/print/attribute/standard/Media.java (equals):
        Reimplemented to allow future subclasses to behave correctly.

Index: javax/print/attribute/standard/Media.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/Media.java,v
retrieving revision 1.5
diff -u -r1.5 Media.java
--- javax/print/attribute/standard/Media.java	16 Dec 2005 19:27:47 -0000	1.5
+++ javax/print/attribute/standard/Media.java	19 Dec 2005 10:48:19 -0000
@@ -93,14 +93,11 @@
    */
   public boolean equals(Object obj)
   {
-    if ((obj instanceof MediaName && this instanceof MediaName)
-        || (obj instanceof MediaTray && this instanceof MediaTray)
-        || (obj instanceof MediaSizeName && this instanceof MediaSizeName))
-      {
-        return ((Media) obj).getValue() == this.getValue();
-      }
+    if (obj == null)
+      return false;
     
-    return false;
+    return (obj.getClass() == this.getClass()
+            && ((Media) obj).getValue() == this.getValue());      
   }
 
   /**
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to