On Wed, 24 Sep 2025 17:37:59 GMT, Naoto Sato <[email protected]> wrote:

> Fixing `CompactNumberFormat.clone()` to clone mutable reference objects. The 
> bug was caused by accessing the shared objects concurrently which resulted in 
> an illegal state on parsing. There are other reference fields that are 
> shared, but the contents of those fields (such as prefix/suffix) are 
> constants/read-only, so they may be shared.

src/java.base/share/classes/java/text/CompactNumberFormat.java line 2508:

> 2506:     @Override
> 2507:     public CompactNumberFormat clone() {
> 2508:         CompactNumberFormat other = (CompactNumberFormat) super.clone();

Maybe a comment indicating why we don't need to handle the `List<Patterns>` 
fields would be helpful for maintainers. (Since they are read-only after 
construction.) Otherwise we have to dig around the use sites to figure that out.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27475#discussion_r2377131363

Reply via email to