1 2 Previous Next 19 Replies Latest reply on Feb 28, 2011 10:42 AM by kabirkhan Go to original post
      • 15. Checkstyle
        jason.greene

        Th code cleanup Template should have remove trailing ws checked. Is it checked for you?

        • 16. Checkstyle
          bosschaert

          I always have this done in Eclipse as a Save Action. In the Preferences menu you go to Java -> Editor -> Save Actions and there you can add 'Remove trailing white space on all lines' in the 'Additional Actions' section to get them removed automatically whenever you save a Java file...

          • 17. Checkstyle
            jpearlin

            I have both the trailing whitespace removal and the template enabled.  It definitely removes the trailing whitespace from all other lines (I tested by adding some whitespace to a random line and watched the save action remove it).  It appears to be an issue with the Javadoc configuration in the template itself.  If you go to the Formatter in Eclipse (the template) and click on the Comments tab and enable the invisible characters, you will see the space before the CRLF in the template.  I tried re-importing all of the IDE configs, just to make sure I didn't have older ones/out of date ones, but that did not solve the issue.  The auto-formatting in the save actions appears to apply the template AFTER removing the whitespace, so it gets added back as part of the template (I am using Helios, btw).  I am going to mess around with this some more just to make sure it is not something dumb on my end.

            • 18. Checkstyle
              jason.greene

              Ah ok that makes sense. Reformat on save should definitely be turned off, so our configs need to be fixed (I'll look at that). The feature is coun ter productive not just because of the bug you found, but also because constant reformatting increases the odds of a source conflict, and it makes cone review and history harder to read. Trailing ws on the other hand is an exception because check style won't allow it, so we never have to worry about a conflict

              • 19. Checkstyle
                kabirkhan

                I have the same problem sometimes after recreating my Eclipse workspace (which seems to be more and more necessary with every Eclipse/m2eclipse plugin upgrade). But basically importing the template and using only the following save actions work for me:

                • Organize imports
                • Additional actions
                  • Remove trailing whitespace on all lines
                1 2 Previous Next