
Why does array[i++%n] += i+“ ” give different results in Java 8 and Java 10? - dpflan
https://stackoverflow.com/questions/50683786/why-does-arrayin-i-give-different-results-in-java-8-and-java-10
======
saurik
(For anyone who is like "that looks inherently undefined due to using i++ and
i in the same statement", that is likely not true of Java anyway--which loves
to define stuff like that--but more importantly: this issue turned out to have
nothing to do with that, and is much more general and arguably a dangerous bug
in the compiler starting with Java 9 related to +=.)

~~~
skywhopper
Yes this does look dangerous. Basically `strArray[keyLookup()] += “s”`
evaluates `keyLookup()` or whatever is in the brackets twice. So if there’s a
side effect to that function that’s going to behave badly. Limited to arrays
of `String` apparently.

