When you type /** and Enter above a method in Eclipse, it will generate the Javadoc, for example:
当您在Eclipse中键入/ **和Enter一个方法时,它将生成Javadoc,例如:
/**
* Finds a World using a String, greets the World,
* and then returns a reference to the World.
*
* @param world - the World to find and greet.
* @return the reference to the World.
* @throws ApocalypseException - if the World is not found.
*/
public World helloWorld(String world) throws ApocalypseException {
...
}
However, sometimes when I am adding Javadoc to methods, it will randomly stop generating:
但是,有时当我将Javadoc添加到方法时,它会随机停止生成:
/**
*
*/
public Universe helloUniverse(String universe) throws BigBangException {
...
}
This is not specific to a class. I will generate 5 or so methods in a class and then it simply stops generating. I assumed that Workspace could not read my class files, so I deleted them and recompiled, but this did not fix the issue. I've also tried restarting Eclipse and that did not work either.
这不是一个特定的类。我将在一个类中生成5个左右的方法然后它只是停止生成。我假设Workspace无法读取我的类文件,所以我删除了它们并重新编译,但这并没有解决问题。我也试过重启Eclipse,但也没用。
2 个解决方案
#1
0
Dunno your specifics, but if you try to create a method that it can't quite figure out (e.g., put a class you haven't imported yet as a return value), you'll get the second result in place of the desired one.
不知道你的具体细节,但是如果你试图创建一个它无法弄清楚的方法(例如,把一个你尚未导入的类作为返回值),你将得到第二个结果代替所需的一。
Either way, you can try to force the javadoc comment generation by highlighting the method name and using "Source"->"Generate Element Comment" (from context menu or window menu bar). Or the hotkey for that, whatever it's assigned to in your eclipse prefs.
无论哪种方式,您都可以尝试通过突出显示方法名称并使用“Source” - >“Generate Element Comment”(从上下文菜单或窗口菜单栏)强制生成javadoc注释。或者热键,无论它在你的eclipse prefs中分配给它。
#2
0
To fix this I cut all the methods that were not generating Javadoc into a class with similar imports and then proceeded to generate the Javadoc comments in that other class and they generated correctly. I then cut them back into the original class without any errors.
为了解决这个问题,我将没有生成Javadoc的所有方法切换到具有类似导入的类中,然后继续在其他类中生成Javadoc注释并正确生成它们。然后我将它们切换回原始类,没有任何错误。
This might be a bug in Eclipse, because it happens to me quite often.
这可能是Eclipse中的一个错误,因为它经常发生在我身上。
#1
0
Dunno your specifics, but if you try to create a method that it can't quite figure out (e.g., put a class you haven't imported yet as a return value), you'll get the second result in place of the desired one.
不知道你的具体细节,但是如果你试图创建一个它无法弄清楚的方法(例如,把一个你尚未导入的类作为返回值),你将得到第二个结果代替所需的一。
Either way, you can try to force the javadoc comment generation by highlighting the method name and using "Source"->"Generate Element Comment" (from context menu or window menu bar). Or the hotkey for that, whatever it's assigned to in your eclipse prefs.
无论哪种方式,您都可以尝试通过突出显示方法名称并使用“Source” - >“Generate Element Comment”(从上下文菜单或窗口菜单栏)强制生成javadoc注释。或者热键,无论它在你的eclipse prefs中分配给它。
#2
0
To fix this I cut all the methods that were not generating Javadoc into a class with similar imports and then proceeded to generate the Javadoc comments in that other class and they generated correctly. I then cut them back into the original class without any errors.
为了解决这个问题,我将没有生成Javadoc的所有方法切换到具有类似导入的类中,然后继续在其他类中生成Javadoc注释并正确生成它们。然后我将它们切换回原始类,没有任何错误。
This might be a bug in Eclipse, because it happens to me quite often.
这可能是Eclipse中的一个错误,因为它经常发生在我身上。