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

java.awt.geom.Area.equals(Object) not overridden

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.3.0, 5.0
    • client-libs
    • 2d
    • generic, sparc
    • generic, solaris_9

      Name: yyT116575 Date: 11/21/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


      Design-Problem in java.awt.geom.Area:
      The equals-Method is redefined in Area, but as the argument of equals in
      class Area is Area and not Object, equals is not overridden but overloaded!
      If such objects are included in a Set (e.g.) they are not considered as equal.

      Example:
      java.awt.geom.Area a1 = new java.awt.geom.Area();
      java.awt.geom.Area a2 = new java.awt.geom.Area();
      System.out.println(a1 == a2); // false
      System.out.println(a1.equals(a2)); // true
      System.out.println(a1.equals((Object)a2)); // false !!

      If the behavior is intended, then the name of the method should probably
      be changed.
      (Review ID: 112539)
      ======================================================================

            kaddepalli Krishna Addepalli
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: