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

DOC bug: API spec java.awt.Rectangle - undefined behavior for neg width, height

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1.4
    • CPU:
      sparc
    • OS:
      solaris_2.5.1
    • Verification:
      Not verified

      Description

      *background information:

      Right now, x,y,width, and height can be any integer value.

      Ideally, width and height should be non-negative since x and y are supposed to define the top-left coordinate of the rectangle (of course, if width or height is negative, (x,y) is no longer the upper left corner). However, because fields height, width, x, and y are all public, so there is no way to limit their ranges.

      The methods in this class assume non-negative values of width and height and
      as a result do not produce meaningful results when width or height is negative.

      *The following needs to be documented:

      The public fields width and height will be deprecated for JDK 1.1. Accessor
      methods for width and height will be added for JDK 1.1. Each method
      will have the added description that behavior is undefined for any rectangle
      with a negative width or negative height. The constructors should have
      throw clauses added that throw IllegalArgumentException when they are called
      with negative width or negative height values.



        

        Attachments

          Activity

            People

            • Assignee:
              asommere Alan Sommerer (Inactive)
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: