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

(spec str) StringBuffer.ensureCapacity() should mention that capacity is mutable

    XMLWordPrintable

Details

    • b58
    • generic, x86
    • generic, windows_2000
    • Verified

    Description

      Name: nt126004 Date: 07/29/2002


      FULL PRODUCT VERSION :
      java version "1.4.0_01"

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      StringBuffer.ensureCapacity(int minimum) sounds like a
      function that will guarantee that the capacity of the
      StringBuffer will ALWAYS be at least as big as the
      minimum argument passed in. This is NOT true. Through a
      call to delete() the capacity can be reduced below the
      specified minimum. Of course later, if one tries to
      append(), then the capacity will be increased again above
      the minimum. But for a while, the capacity was actually
      below the minimum. The name of this function is misleading
      and will cause errors in people's programs who assume that
      capacity is ALWAYS greater than minimum. Thanks.

      The problem is in the java 1.4 api:
      http://java.sun.com/j2se/1.4/docs/api/

      REPRODUCIBILITY :
      This bug can be reproduced always.
      (Review ID: 159691)
      ======================================================================
      Changing this to a documentation bug. If, after analysis, the description is determined to be correct, then the javadoc should be updated. We will not change the name of the method (obviously)! If the doc is correct and the functionality is incorrect, we'll change it back to a functionality bug.

      Attachments

        Issue Links

          Activity

            People

              jgish Jim Gish
              nthompsosunw Nathanael Thompson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: