Breaking java.lang.String
Calling this a &quot;bug in java.lang.String&quot; is silly. The same &quot;bug&quot; exists for all functions that take mutable objects. If you take a map and lookup two different keys, yep, that&#x27;s a &quot;bug&quot;.<p>The bug is the other piece of code that introduces the data race in the first place. You can argue the case for languages like Rust with it&#x27;s borrow system, or others that use linear types or something along those lines, to eliminate the possibility of this happening, but it&#x27;s quite misleading to say that the innocent user of a mutable object is the source of a bug. You may as well say there&#x27;s a bug in `printf(&quot;Hello, World!\n&quot;);` in C because you could have another thread writing random values to random memory, running `while(1) { *((unsigned char*)(void*)rand()) = rand(); }`