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

Polygon returns a reference to its cached bounds field

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs
    • None
    • 2d
    • generic
    • generic

      The Polygon class tries to save calculation time by keeping a Rectangle
      object cached which represents the bounds of the points in the polygon.
      Unfortunately, the getBoundingBox() method is implemented to return the
      reference to this cached bounds object. Thus, if the caller modifies
      the Rectangle they get back, they can corrupt the internal notion of the
      bounds of the points. This will affect further calls to the hit testing
      methods and getBounds().

            flar Jim Graham
            flar Jim Graham
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: