如何使重写方法中的 javadoc 注释可见
我正在使用 Eclipse。我希望显示在重写方法中所做的注释。
这是一个示例 -
enum Foo{
ITEM{
/**
* Arguments must be received in the following order...
*/
@Override
void bar(String[] args){...}
};
/**
* Bars the specific args
* @param args the specific args
*/
abstract void bar(String[] arags);
}
当我有类似以下 Foo.ITEM.bar(...)
的内容并将鼠标悬停在其上时,我想阅读
禁止特定参数
参数必须按以下顺序接收...
@args具体参数
这可能吗?
I'm using Eclipse. I want the comments made in the overridden method to appear instead.
Here's an example -
enum Foo{
ITEM{
/**
* Arguments must be received in the following order...
*/
@Override
void bar(String[] args){...}
};
/**
* Bars the specific args
* @param args the specific args
*/
abstract void bar(String[] arags);
}
When I have something like the following Foo.ITEM.bar(...)
and I hover over it, I want to read
Bars the specific args
Arguments must be received in the following order...
@args the specific args
Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果我正确理解你想要什么,这就是
{@inheritDoc}
的用途。将其放在注释正文或适当的标记中以从超类/接口声明中获取注释。来源和相关摘录:
If I understand what you want correctly, this is what
{@inheritDoc}
is for. Place it in the comment body or appropriate tag to get the comment from the superclass/interface declaration.Source and relevant excerpt:
我不认为你真的可以拥有单个枚举常量方法的 Javadoc。
因此,要么将重要信息放入通用方法(即
Foo.bar
)中,要么将其放入单个常量的文档中(即Foo.ITEM
)。各个常量的方法不应该有太大的不同,以至于它们无论如何都需要单独的注释。I don't think you can really have Javadocs for individual enum constants' methods.
So, either put the important information into the general method (i.e.
Foo.bar
), or into the documentation of the individual constant (i.e.Foo.ITEM
). The methods for the individual constants shouldn't be that different that they require individual comments anyways.如果它是一个接口,请将javadoc添加到接口中,然后使用@Override标签,它应该会显示出来。
If it's an interface, add the javadoc to the interface, and then use the @Override tag, and it should show up.