Community
Participate
Working Groups
Using the built-in Eclipse profile and ticking 'Never join lines' creates an extra level of indent when formatting the following code: import java.util.concurrent.Executors; public class Formatter { public static void main(String[] args) { Executors.newCachedThreadPool().execute(new Runnable() { public void run() { throw new UnsupportedOperationException("stub"); } }); } } Screenshot will be attached. -- Configuration Details -- Product: Eclipse Platform 3.3.200.v200905282000 (org.eclipse.platform.ide) Installed Features: org.eclipse.jdt 3.5.0.v20090527-2000-7r88FEeFJePyvYe69JGnUag1
Created attachment 138488 [details] Correct output - Eclipse [built-in] formatter
Created attachment 138489 [details] Incorrect output - modified formatter This is the output of the built-in formatter with the 'Never join lines' option checked.
Created attachment 139303 [details] Proposed patch Do not add indentation on a closing brace which most of times means the end of a block, hence the indentation will be set while visiting the parent node...
Released for 3.6M1 in HEAD stream.
Verified for 3.6M1 using build I20090802-2000
Can the fix also be released as a hotfix in 3.5.1? "Never join lines" (= "respect my new lines") is unusable due to this bug and we 'd like to use such a handy feature before june 2010 :)
(In reply to comment #6) > Can the fix also be released as a hotfix in 3.5.1? > "Never join lines" (= "respect my new lines") is unusable due to this bug and > we 'd like to use such a handy feature before june 2010 :) This fix was finally reverted as it did not completely fix all cases (see bug 283467, bug 286601 and bug 286668). We also realized that side effects were also introduced on previous formatter behavior while trying to fix these issues (see bug 286912) as well as some regression (see bug 287462)... So this is a long story and this definitely cannot be fixed for 3.5.1 which is now in a freeze state. Satyam could you prepare a patch for the R_3_5_maintenance stream and attach it to the bug then Olivier can look at it and decide whether it could be an acceptable fix for 3.5.2?
Satyam, please prepare a patch for 3.5 maintenance stream. We will target 3.5.2. It is definitely too late for 3.5.1.