简体   繁体   中英

How to change Java comments template?

I use /** + ENTER to generate javadoc, but i found there's a whitespace before line 3:

1 /**
2 * Test.
3 * 
4 * @author xxx
5 */

Every time i try "source - format" in eclipse,the white space comes out. How can i remove this whitespace in the comments template somewhere ?

I have option Blank line before Javadoc tags in preference->Java->Code style->Formater, click on Edit button, open Comments tab and look at Javadoc comment settings . May be it helps you.

This has been pissing me off for some time until I finally found the solution . He mentions this is work around, it does not matter for me - it works like a charm. Don't forget to plus him, he is life savior!

You may need to turn off Javadoc comment formatting completely.

Since Javadoc comments get turned into HTML with the default Javadoc generator/snippet, it doesn't care about extra spaces, or line breaks. One whitespace character is the same as many.

This is reflected by the Eclipse Javadoc formatter, which will treat it as a piece of markup which can be completely reformatted, so long as the output looks the same to Javadoc. I can't see any way to change the options to preserve that whitespace without turning off the formatting altogether.

您可以在Eclipse-> preference-> Java-> Code style-> Code Templates-> Types中进行设置,然后进行编辑,并可以插入日期,时间等变量。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM