Is there a way to generate javadoc comments in eclipse?
after finding the answer on google, I researched SO and found this answer: http://stackoverflow.com/questions/29689/javadoc-template-generator/31946#31946
antony.trupe
2009-11-21 23:49:51
I actually am going to try to avoid using this plugin, but will leave the answer(unless it gets down-voted) to close any information circles.
antony.trupe
2009-11-22 00:08:35
+1
A:
- At a place where you want javadoc, type in
/**
<NEWLINE> and it will create the template. - Under the Project menu: Generate Javadoc.
bmargulies
2009-11-21 23:51:04
1. that works, thank. 2. that menu item isn't in any of the perspectives I use.
antony.trupe
2009-11-21 23:59:44
It's on my Eclipse, and the only extra things I've installed are Google Web Toolkit and FindBugs. (This is Ganymede, not Europa. Maybe you need to upgrade?)
Paul Tomblin
2009-11-21 23:56:12
Maybe you need to install Eclipse for Java Developers or Eclipse for J2EE developers.
Jherico
2009-11-22 00:00:30
What happens if you go to Preferences->Java->Code Templates and click "restore defaults"? Because I have code templates for comments that includes all the javadoc stuff.
Paul Tomblin
2009-11-22 00:01:00
it appears all the templates are present. I clicked "restore defaults" to be sure nothing crazy is going on. I just don't have that menu option. My hunch is I have a subset of the "usual" features of eclipse.
antony.trupe
2009-11-22 00:05:35
Anyway, this is not what the OP is looking for. The question (which is a bit misleading) is not about generating the javadoc but adding javadoc "comments" in the code.
Pascal Thivent
2009-11-22 00:35:03
+2
A:
Shift-Alt-J
is a useful keyboard shortcut in Eclipse for creating Javadoc comment templates.
Invoking the shortcut on a class, method or field declaration will create a Javadoc template:
public int doAction(int i) {
return i;
}
Pressing Shift-Alt-J
on the method declaration gives:
/**
* @param i
* @return
*/
public int doAction(int i) {
return i;
}
coobird
2009-11-22 00:18:55
+4
A:
For me the "/**<NEWLINE>" or "Shift-Alt-J" approach works best.
I dislike seeing Javadoc in source code that has been auto-generated and then had no effort put into adding any real content added. As far as I am concerned they are nothing more than a waste of screen space.
IMO, it is much much better to generate the Javadoc comment skeletons one by one as you are about to fill in the details.
Stephen C
2009-11-22 00:23:54
@Pascal - I'd prefer to delete it/them, or not generate it/them in the first place. IMO, generated javadoc comments add zero value ... unless you count a bogus boost to the comment-to-code ratio as "value".
Stephen C
2009-11-22 02:54:17