Community
Participate
Working Groups
Build Identifier: M20120208-0800 Sample code: public class Test { private static final int test=1; private static final int test2 = 2; // @formatter:off private static final int test3333333 = 3; // @formatter:on } When I run the formatter, an extra newline is added before the first "private static" declaration every time the formatter runs (which can add up to a lot of newlines if the formatter runs every time I save). Additionally, the first two declarations are not formatted, as if the @formatter:off was being applied to the entire block. I can re-enable it manually via: public class Test { // @formatter:on private static final int test = 1; private static final int test2 = 2; // @formatter:off private static final int test3333333 = 3; // @formatter:on } I formatted this to show what it looks like after formatting, in order to show that the extra newline still appears before the comment. Additional calls to "format" still add more newlines. If viewing this with a fixed-width font, you will also notice that the formatted lines are actually lined up with the width of the variable name in the no-format section, which would be where its = character should be if I wasn't trying to demonstrate somewhere I wanted formatting to be ignored (this is much more apparent if you give the field a much longer name, as I have for the example). If I remove all of the @formatter calls, things align correctly and no extra newlines are added, though that defeats the purpose of disabling formatting for a particular line Note that because of the "extra newlines" symptom this *might* be related to bug 377914 -- the settings were different enough that I decided to file this one separately. Reproducible: Always Steps to Reproduce: See "details"
This problem no longer occurs after the formatter redesign. *** This bug has been marked as a duplicate of bug 303519 ***
Verified for Eclipse Photon (4.8) M6 with Build id: I20180306-0800