Community
Participate
Working Groups
From EC: Reproduce with build 0109: [public class Bug { public static void main(String[] args) { String s = "4"; s = '0' + s; System.out.println( "test: " + s ); } }] The output is: test: 40 With javac 1.3, the output is: test: 04 Need investigation why the concatenation is reversed.
This is a code gen optimization bug: s = '0' + s --> s += '0', but in the case of a String concat it is not allowed.
There was a fix in this area already, but the fix did only look at the left operand instead of both operands of the + expression to check for String... Fixed.
Couldn't we check that the operation implicit conversion isn't T_String instead of checking the left and the right?
Backported to 1.0 stream (rollup2)
Verified and added test case (see ConformTest.test109).
Verified in rollup2.