4

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 ?

WoooHaaaa
  • 19,732
  • 32
  • 90
  • 138
  • 5
    Did you try preference->java->Code Style->Code Templates.And edit your template? – Yahor10 Feb 01 '12 at 08:36
  • I have tried it already, but i didn't find any thing can solve the problem since there's no option about whitespace in comment settings. – WoooHaaaa Feb 01 '12 at 08:41
  • possible duplicate of [Eclipse formatter adds space in empty comment lines](http://stackoverflow.com/questions/7008340/eclipse-formatter-adds-space-in-empty-comment-lines) – mgibsonbr Nov 19 '12 at 22:01

4 Answers4

1

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.

e-zinc
  • 4,491
  • 2
  • 20
  • 17
  • Thanks,but i need the blank line without a whitespace before it(Check my code you will find a whitespace after * in line 3). – WoooHaaaa Feb 01 '12 at 09:21
0

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!

Community
  • 1
  • 1
Boris Strandjev
  • 46,145
  • 15
  • 108
  • 135
  • The work around mentioned in http://stackoverflow.com/a/7727232/1108032 doesn't work if you right click on a package and execute the `Format` action. – Manoj Govindan Feb 26 '12 at 11:57
  • Include answer in case link is broken. – F.O.O Aug 02 '15 at 18:16
  • @F.O.O This is link directlly to Stackoverflow - chances are that my answer will get deleted before the one i link to. Furthermore I deliberately link without including the answer contents - thus the updates there will immediately be reflected in my answer too, you see :) – Boris Strandjev Aug 02 '15 at 19:46
  • I did think this was to an external site :D. sorry. – F.O.O Aug 03 '15 at 06:42
-1

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.

Kothar
  • 6,579
  • 3
  • 33
  • 42
-2

you can set it in Eclipse->preference->Java->Code style->Code Templates->Types,then you can edit it, and you can insert variables,such as date,time...

ender
  • 1