korshyadoo
korshyadoo

Reputation: 337

Eclipse no longer automatically adding tags in javadocs

In eclipse, if I have a method that I want to add a javadoc for, I used to be able to go to the line above the method declaration, type /** and Enter, and it would automatically create the proper tags, i.e. @returns, @throws IllegalArgumentException, etc. But it doesn't do that anymore for some reason. I've tried restoring defaults on Preferences -> Java -> Code Style -> Code Templates and Preferences -> Java -> Editor -> Templates and still no luck.

Upvotes: 1

Views: 435

Answers (2)

Christopher Z
Christopher Z

Reputation: 952

To check if Eclipse is automatically adding tags, open up the Preferences screen; then expand to Java -> Code Style -> Code Templates.

Expand the Comments, and you should see a list of items. These items are where you can change the auto-generated JavaDoc comments. For example, the method comment from my settings is as follows.

/**
 * ${tags}
 */

In any case, the ${tags} informs the JavaDoc generator to generate the necessary tags for JavaDoc comments on methods. So, if it is missing, just add it. You will need to go and check the other items as well.

Upvotes: 0

Magnilex
Magnilex

Reputation: 11958

There is an alternative shortcut, which I always use:

Alt + Shift + j

Just step onto the method and press the key combination.

Upvotes: 2

Related Questions