Community
Participate
Working Groups
Overview: If I have an if/else statement inside a lambda it gets incorrectly formatted with certain formatter settings Steps To Reproduce: - Open formatter settings - On braces tab select "next line" for blocks - On control statements check "Insert new line before 'else' in an 'if' statement - Create a simple test that uses an if/else inside a lambda, like so: Executors.newSingleThreadExecutor().execute(() -> { if (true) { System.err.println("foo"); } else { System.err.println("bar"); } }); Actual results: Not sure if bugzilla will format this correctly but the above example is what I see. The entire else block is shifted over to the right when it shouldn't be. Expected results: The else block should be lined up with the if statement Build: Has been happening on Kepler with java 8 patches as well as the 4.4 nightly/integration builds with java 8 added (on a Mac)
This issue has been resolved by the formatter redesign bug 303519. Test case committed via http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=f5f144eaadfc3b2a6a242fa2d3bde9667704484e *** This bug has been marked as a duplicate of bug 303519 ***