Community
Participate
Working Groups
The following code formats correctly. However if you add a comment at the end of the 6th line and then format the code, the result is very strange. public class ttt { public static void main() { if (true) if (false) System.out.println("meuh"); else System.out.println("coucou"); else { System.out.println("bar"); } } } PaScaL
The comment needs to be added at the end of the line : System.out.println("meuh");
Will consider post 2.0
Reopening
Clearing resolution
The cause of the problem is that 'clearNonBlockIndents' is reset during the use of the comment token in the format method from CodeFormatter. A solution is to exclude comment tokens from the condition that protect the removing of all indentations made by statements not followed by a block except if the current token is ELSE, CATCH or if we are in a switch/case The proposal is to update the line 365 in the version from eclipse 2.0.1 from if (clearNonBlockIndents && (token != Scanner.TokenNameWHITESPACE)) { to if (clearNonBlockIndents && (token != Scanner.TokenNameWHITESPACE) && (token != TokenNameCOMMENT_BLOCK) && (token != TokenNameCOMMENT_JAVADOC) && (token != TokenNameCOMMENT_LINE )) {
We need to clear 2.1 bug reports that won't be addressed before 2.1. The new implementation is still in the works. Therefore we cannot include it for 2.1. Not enough testing and we need to polish the preferences. This will be address for 2.2 as stated in the JDT/Core plan.
Resurrecting for 3.0
Reopen for 3.0 consideration.
This is addressed in the new formatter. Fixed and released in HEAD. Regression test added.
Verified.