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

RFE: Insufficient API documentation for java.awt.Polygon constructor

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • client-libs
    • None
    • 2d
    • medium

      Summary

      Clarify the documentation of creating a java.awt.Polygon.

      Problem

      An initializer of the Polygon class does not describe how it uses the arrays passed into it as parameters. Passing an array could mean a pass-by-value or a pass-by-reference, but that isn't specified. Whatever is done with the array after the initialization is important so that the polygon won't differ across different implementations. In the OpenJDK, the arrays are copied by value.

      Solution

      Clarify that the initializer copies the arrays passed in.

      Specification

      @@ -133,8 +133,10 @@ public Polygon() {
           }
      
      
               /**
          -     * Constructs and initializes a {@code Polygon} from the specified
          -     * parameters.
          +     * Constructs and initializes a {@code Polygon} from the
          +     * specified parameters, copying the array contents of
          +     * {@code xpoints} and {@code ypoints}.
          +     *
                 * @param xpoints an array of X coordinates
                 * @param ypoints an array of Y coordinates
                 * @param npoints the total number of points in the

            avu Alexey Ushakov
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: