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

RoundRectangle2D & Ellipse2D fail to override equals properly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 6
    • Component/s: client-libs
    • Subcomponent:
      2d
    • Introduced In Version:
    • Resolved In Build:
      b56
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: