开发者

Generating JavaDoc comments for existing code in Eclipse

I know it's po开发者_Go百科ssible to generate comments for classes, interface, etc., in the wizard screen when creating them, but I haven't found an option to generate javadoc comments for an existing file. Is it possible?

Thanks.


The command is "Add Javadoc Comment", or "Generate Element Comment" (Alt+Shift+J), and it is dependent on the one element currently selected.

It cannot be applied to a all file. So if you select the all class through the project explorer view, you won't be able to generate all the missing comments from there.

But from the Project Explorer, as Vitalii Fedorenko mentions in the comments, it works (just tested it):

you should expand a class in the Package Explorer, select all elements and press Alt+Shift+J

Generating JavaDoc comments for existing code in Eclipse


If you like to keep both hands on keyboard, then typing /** on the line before a method and pressing enter works too:

/**[press enter here]
int avg(int a, int b) throws ArithmeticException {
    ...
}

-->

/**
 * 
 * @param a
 * @param b
 * @return
 * @throws ArithmeticException
 */
int avg(int a, int b) throws ArithmeticException {
    ...
}


This https://stackoverflow.com/a/8223484/830945 provides a very solution for this problem.

I myself have tested it and it works very well with eclipse. You just need to right click project, then choose required option. can be downloaded from http://jautodoc.sourceforge.net/index.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜