RFR: JDK-8236683 StringBuilder / StringBuffer capacity() doc is misleading (CSR)

Brent Christian brent.christian at oracle.com
Mon Jan 6 21:42:58 UTC 2020


Looks reasonable to me - reviewed.
-Brent

On 1/6/20 10:29 AM, Jim Laskey wrote:
> Please review the following CSR intended to clarify the true meaning of StringBuilder::capacity and StringBuffer::capacity.
> 
> csr: https://bugs.openjdk.java.net/browse/JDK-8236683
> 
> 
> diff --git a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java
> --- a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java
> +++ b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java
> @@ -181,9 +181,9 @@
>       }
> 
>       /**
> -     * Returns the current capacity. The capacity is the amount of storage
> -     * available for newly inserted characters, beyond which an allocation
> -     * will occur.
> +     * Returns the current capacity. The capacity is the number of characters
> +     * that can be stored (including already written characters), beyond which
> +     * an allocation will occur.
>        *
>        * @return  the current capacity
>        */
> 
> 
> 


More information about the core-libs-dev mailing list