On Tue, 7 Apr 2026 15:53:25 GMT, Eirik Bjørsnøs <[email protected]> wrote:

> Please review this small cleanup which removes the fourth sentence of the 
> class-level Javadocs of `java.lang.String`:
> 
> _String buffers support mutable strings_
> 
> Mentioning "mutable strings" while just establishing that strings are 
> immutable in Java is confusing. It is also unclear what "String buffers" 
> should refer to.
> 
> While it could be possible to improve the phrasing of this sentence, the end 
> result would still be out of context here, so this PR suggests that we simply 
> remove this sentence.
> 
> This was initially discussed on core-libs: 
> https://mail.openjdk.org/archives/list/[email protected]/thread/2WP6UB3LMJGTRPOJILFLTNEGVBDUCKAU/
> 
> Javadoc-only cleanup, `noreg-doc`. 
> 
> It is my understanding that this change is not normative and does not warrant 
> a CSR.

src/java.base/share/classes/java/lang/String.java line 75:

> 73:  * Strings are constant; their values cannot be changed after they
> 74:  * are created.
> 75:  * Because String objects are immutable they can be shared. For example:

It looks like this paragraph dates back to JDK 1.0, it's just that it wasn't 
linked to StringBuffer at the time. I agree the sentence should be removed but 
it did have the effect of using "mutable" before the word "immutable" appears 
in the next sentence. Maybe we should change "Strings are constant" to "Strings 
are  immutable" as part of this, as that would avoid using two terms in this 
small paragraph.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30608#discussion_r3049936920

Reply via email to