如何在 Eclipse 中生成 Javadoc 注释?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1777175/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I generate Javadoc comments in Eclipse?
提问by antony.trupe
Is there a way to generate Javadoc comments in Eclipse? If so, what is it?
有没有办法在 Eclipse 中生成 Javadoc 注释?如果是,那是什么?
采纳答案by Stephen C
For me the /**<NEWLINE>
or Shift-Alt-J(or ?-?-Jon a Mac) approach works best.
对我来说,/**<NEWLINE>
or Shift- Alt- J(或?- ?-J在 Mac 上)方法效果最好。
I dislike seeing Javadoc comments in source code that have been auto-generated and have not been updated with real content. As far as I am concerned, such javadocs are nothing more than a waste of screen space.
我不喜欢在源代码中看到 Javadoc 注释,这些注释是自动生成的并且没有用实际内容更新。就我而言,这样的 javadoc 无非是浪费屏幕空间。
IMO, it is much much better to generate the Javadoc comment skeletons one by one as you are about to fill in the details.
IMO,当您将要填写详细信息时,一一生成 Javadoc 注释框架要好得多。
回答by antony.trupe
回答by bmargulies
At a place where you want javadoc, type in /**
<NEWLINE> and it will create the template.
在需要 javadoc 的地方,输入/**
<NEWLINE>,它将创建模板。
回答by Mirek Pluta
You mean menu Project -> Generate Javadoc ?
你的意思是菜单 Project -> Generate Javadoc ?
回答by coobird
Shift-Alt-J
is a useful keyboard shortcut in Eclipse for creating Javadoc comment templates.
Shift-Alt-J
是 Eclipse 中用于创建 Javadoc 注释模板的有用键盘快捷键。
Invoking the shortcut on a class, method or field declaration will create a Javadoc template:
在类、方法或字段声明上调用快捷方式将创建一个 Javadoc 模板:
public int doAction(int i) {
return i;
}
Pressing Shift-Alt-J
on the method declaration gives:
按Shift-Alt-J
方法声明给出:
/**
* @param i
* @return
*/
public int doAction(int i) {
return i;
}