Community
Participate
Working Groups
Build Identifier: 20100218-1602 The "Use 'MessageFormat' for string concatenation" option given by Quick Fix in the context of a string concatenation with the + operator will give up if it encounters unparenthesised numeric arithmetic. It's a good idea to parenthesise such expressions anyway, but it would be nice if the case was handled transparently. Reproducible: Always Steps to Reproduce: 1. Write: String test = "hello " + 4*2 + "a " + 3 + " c" + 4; 2. Put the cursor at the start of the string (or somewhere where the Quick Fix expects it) and open the quick fix menu (ctrl+1) 3. Select "Use 'MessageFormat' for string concatenation" (or StringBuilder) Expected result: MessageFormat.format("hello {0}a {1} c{2}", 4*2, 3, 4) Actual result: MessageFormat.format("{0}{1}", "hello " + 4*2 + "a " + 3 + " c", 4) Workaround: Parenthesise the problem expression. String test2 = "hello " + (4*2) + "a " + 3 + " c" + 4;
(In reply to comment #0) > Build Identifier: 20100218-1602 This works with the latest release Eclipse 3.6 - http://download.eclipse.org/eclipse/downloads/drops/R-3.6-201006080911/index.php . Can you please try with the this. Closing as WORKSFORME.
(In reply to comment #1) > (In reply to comment #0) > > Build Identifier: 20100218-1602 > > This works with the latest release Eclipse 3.6 - > http://download.eclipse.org/eclipse/downloads/drops/R-3.6-201006080911/index.php > . Can you please try with the this. > > Closing as WORKSFORME. Hi, You're right, it's fixed indeed. Thanks :)