Project: JDT
Bug 275360 [toString] Wrong code generated with String concatenation
Reported: 2009-05-07 15:15:49 | Status: verified fixed

When String concatenation style is used, wrong code is generated, for example: public class A { String ss[]; @Override public String toString() { final int maxLen = 10; return "A [ss=" + ss != null ? Arrays.asList(ss).subList(0, Math.min(ss.length, maxLen)) : null + "]"; } } The "ss != null ? .. : null" fragments should be enclosed in parenthesis, otherwise there's a compilation error or unexpected behavior.

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/source/GenerateToStringTest.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/tostringgeneration/StringConcatenationGenerator.java