<story><title>Java: &quot;+=&quot; applied to String operands can provoke side effects</title><url>https://bugs.openjdk.java.net/browse/JDK-8204322</url></story><parent_chain><item><author>kjeetgill</author><text>Wow. This is a pretty big bug.
The official bug report: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;bugs.openjdk.java.net&amp;#x2F;browse&amp;#x2F;JDK-8204322&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;bugs.openjdk.java.net&amp;#x2F;browse&amp;#x2F;JDK-8204322&lt;/a&gt; as Stuart Marks, a jvm architect, posted.
I&amp;#x27;m surprised it stayed uncaught for so long.&lt;p&gt;For the unfamiliar, the way string concatenation is compiled changed with invokedynamic.&lt;p&gt;Previously, it would compile to either Sting.concat calls or transform into a StringBuilder, but with invoke dynamic we can leave it to the runtime to optimize when it first runs.</text></item></parent_chain><comment><author>dtech</author><text>&amp;gt; I&amp;#x27;m surprised it stayed uncaught for so long.&lt;p&gt;I&amp;#x27;m not surprised. Java 9 has minor adoption, and having side effects on the left hand side of an assignment operation is really really bad practice.&lt;p&gt;So you&amp;#x27;d need a codebase that (1) was updated or written in a very new Java version, (2) contained the smelly code and (3) had a harmful double side-effect that got noticed. That&amp;#x27;s a pretty rare combination.</text></comment>
<story><title>Java: &quot;+=&quot; applied to String operands can provoke side effects</title><url>https://bugs.openjdk.java.net/browse/JDK-8204322</url></story><parent_chain><item><author>kjeetgill</author><text>Wow. This is a pretty big bug.
The official bug report: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;bugs.openjdk.java.net&amp;#x2F;browse&amp;#x2F;JDK-8204322&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;bugs.openjdk.java.net&amp;#x2F;browse&amp;#x2F;JDK-8204322&lt;/a&gt; as Stuart Marks, a jvm architect, posted.
I&amp;#x27;m surprised it stayed uncaught for so long.&lt;p&gt;For the unfamiliar, the way string concatenation is compiled changed with invokedynamic.&lt;p&gt;Previously, it would compile to either Sting.concat calls or transform into a StringBuilder, but with invoke dynamic we can leave it to the runtime to optimize when it first runs.</text></item></parent_chain><comment><author>cup-of-tea</author><text>&amp;gt; I&amp;#x27;m surprised it stayed uncaught for so long.&lt;p&gt;You haven&amp;#x27;t heard of the bug in binary search that existed for nine years then?&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;ai.googleblog.com&amp;#x2F;2006&amp;#x2F;06&amp;#x2F;extra-extra-read-all-about-it-nearly.html?m=1&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;ai.googleblog.com&amp;#x2F;2006&amp;#x2F;06&amp;#x2F;extra-extra-read-all-about...&lt;/a&gt;</text></comment>