On Thu, 15 Jan 2026 20:02:59 GMT, Liam Miller-Cushon <[email protected]> wrote:

>> src/java.base/share/classes/java/lang/String.java line 2127:
>> 
>>> 2125:      * <p>The result will be the same value as {@link 
>>> #getBytes(Charset) getBytes(cs).length}.
>>> 2126:      *
>>> 2127:      * @implNote This method may allocate memory to compute the 
>>> length for some charsets.
>> 
>> Would it help if we describe the benefit of this method? Ie, for some 
>> charsets it won't allocate memory thus faster than getBytes(Charset)?
>
> I think that makes sense, I'm not sure what the best way to characterize it 
> is. Probably we don't want to promise specific optimizations. What do you 
> think about:
> 
> 
>      * <p>The result will be the same value as {@link #getBytes(Charset) 
> getBytes(cs).length},
>      * and will have equivalent or better performance.

I think this won't be a normative spec, so I'd move the performance description 
to `@apiNote`

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28454#discussion_r2695837680

Reply via email to