I noticed an odd behavior of the Eclipse formatter (Strg+Alt+F) when running it on a piece of code like this:
/**
* bar
*
* @return nothing
*/
Object foo() {
return null;
}
It will add a trailing space character here:
/**
* bar
* <--- this line has a trailing space now!
* @return nothing
*/
Object foo() {
return null;
}
I know how to configure Eclipse to remove trailing whitespace, but it there a way to stop the formatter from adding it in the first place?
You can just go to Preferences -> Java -> Editor -> Save Actions and configure it to remove trailing whitespace.
In order to do that right-click on your project and go to Properties -> Java Editor -> Save Actions. From there you can enable project specific settings and configure it to remove trailing whitespace (among other useful things).
Under Java -> Code Style -> Formatter . Edit the active profile (you may need to save a new one) On the Comments tab under the Javadoc comment settings area you should uncheck Blank line before Javadoc tags .
Was so annoying before I found this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.