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

RFE: API for java.awt.geom.Path2D storage trimming

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 10
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
      2d
    • Compatibility Kind:
      source
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      In the unlikely event any external code has its own subclass of Path2D it will need to over-ride this abstract method.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Add a new API to the abstract Path2D class and its concrete public nested subclasses to enable trimming the internal storage arrays to the currently needed size.

      Problem

      There are no public method to trim the arrays on an existing path object to just the needed size for long term storage. This would be useful when an object will be kept in a static state for a long time and the added storage that was created for potential growth will never be used.

      Solution

      Add a new API method as discussed above

      Specification

      Add this to the abstract class java.awt.geom.Path2D :-

         /**
           * Trims the capacity of this Path2D instance to its current
           * size. An application can use this operation to minimize the
           * storage of a path.
           *
           * @since 10
           */
          public abstract void trimToSize();
      

      Add over-rides in java.awt.geom.Path2D.Float and java.awt.geom.Path2D.Double :

      @Override
          public final void trimToSize();

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              lbourges Laurent Bourg├Ęs
              Reporter:
              prr Philip Race
              Reviewed By:
              Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: