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

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

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P3
    • 10
    • client-libs
    • None
    • 2d
    • source
    • minimal
    • In the unlikely event any external code has its own subclass of Path2D it will need to over-ride this abstract method.
    • Java API
    • 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

              lbourges Laurent Bourgès
              prr Philip Race
              Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: