JDK-8219409 : Clarify capacity of StringBuffer/StringBuilder near Integer.MAX_VALUE
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 13
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2019-02-20
  • Updated: 2020-04-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
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.