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

Clarify capacity of StringBuffer/StringBuilder near Integer.MAX_VALUE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 13
    • core-libs
    • None

      The specs for various constructors of StringBuffer/StringBuilder contain text like

      "The initial capacity of the string buffer is 16 plus the length of the string argument."

      From a specification perspective, this leaves open the possibility of misbehavior near Integer.MAX_VALUE.

      The spec in question would be improved by covering this situation explicitly, say by having the capacity saturate at MAX_VALUE.

            Unassigned Unassigned
            darcy Joe Darcy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: