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

Clarify capacity of StringBuffer/StringBuilder near Integer.MAX_VALUE

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 13
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                igerasim Ivan Gerasimov
                Reporter:
                darcy Joe Darcy
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: