Community
Participate
Working Groups
It seems as though there is a bug in the compiler. The following code does not compile correctly... public void test() { Object obj = "test"; obj = obj + "ing"; System.out.println(obj); } This produces the following output: "ing" However this code works... public void test() { Object obj = "test"; obj = (String)obj + "ing"; System.out.println(obj); } Thus producing the output: "testing" I noticed that when I compile this under Sun's "javac", it works fine. And when I looked at the PCODE that was produced, it was definitely wrong. <188674>
Known defect which was corrected in 2.0 stream. Bug in code optimization of String concatenation (Object = Object + String --> Object += String). Closing
Closing
Fixed in 1.0 Rollup 139