views:

62

answers:

1

I'm documenting code in Eclipse and have been using the /** followed by Enter alot to insert the Javadoc template. However this does not always work for some reason, it will create the template for writing comments but it won't automatically insert the @param and @return text. If I copy the exact same method to another class it will insert the full template.

It would be a big help if anyone could tell me why it won't do this in some situations.

+4  A: 

As far as I know this usually happens when Eclipse doesn't know for sure which method you want to document.

A more reliable way would be to select the method/class etc. you want to create the JavaDoc for and press ALT + SHIFT + J or right click on the method in the class outline and clicking Source -> Generate element comment.

Daff
Hitting this shortcut will point me to the interface that this class implements (i.e. it inserts (non-Javadoc) and then a line with @See package.class#method(params), I guess it doesn't like Javadoc being added to a class that implements an interface.So if for some reason I do want to document the implementation of an interface, I guess I'll have to do it manually. I realize that might not be the best way to approach documentation but I was just wondering why it didn't work. Thanks!
Bas van den Broek
Well the whole point of methods described by an interface is, that the interface already includes all thedocumentation necessary (and the implementing methods shouldn't behave any different than what theinterface specifies). I would put additional information in the javadoc class header.
Daff
I just found another example in a class that isn't extending or implementing anything. No idea why it doesn't work with /** here but alt-shift-j does insert the javadoc template correctly.
Bas van den Broek