Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6210287

RoundRectangle2D & Ellipse2D fail to override equals properly

XMLWordPrintable

    • 2d
    • b56
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP Home, SP1

      A DESCRIPTION OF THE PROBLEM :
      RoundRectangle2D and Ellipse2D fail to override equals. This behavior is inconsistent with other shapes, such as Rectangle. This can lead to inhomogeneity in client code regarding use of these shapes.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compila and run the test case.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      true
      ACTUAL -
      false

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.geom.*;

      class Test {

      public static void main(String args[]) {

      RoundRectangle2D.Double a=new RoundRectangle2D.Double(10,10,10,10,2,2);
      RoundRectangle2D.Double b=new RoundRectangle2D.Double(10,10,10,10,2,2);
      boolean equal=a.equals(b);
      System.out.println("equal="+equal);

      }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Provide a deep equals test in client code, or override the shape object.
      ###@###.### 2004-12-17 23:16:57 GMT

            flar Jim Graham
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: