我该如何使用 @see
javadoc合适吗?
我的目的是使用抽象方法创建一个抽象类。这些方法有javadoc注释。
现在,如果我扩展抽象类,我会覆盖方法并想要使用 @see
。
但对于所有参数,例如 return
该 @see
链接似乎不起作用。 Eclipse仍抱怨 expected @return tag
。
那我该怎么用?
public abstract class MyBase {
protected abstract void myFunc();
}
class MyImpl extends MyBase {
/**
* @see MyBase#myFunc()
*/
@Override
protected void myFunc() { .. }
}
为了包含来自超类的文档,您应该使用 {@inheritDoc}
不 @see
。
然后你得到超类的文档。你可以添加它,你可以覆盖像这样的东西 @param
和 @return
如果你需要。
public abstract class MyBase {
/**
* @param id The id that will be used for...
* @param good ignored by most implementations
* @return The string for id
*/
protected abstract String myFunc(Long id, boolean good);
}
class MyImpl extends MyBase {
/**
* {@inheritDoc}
* @param good is used differently by this implementation
*/
@Override
protected String myFunc(Long id, boolean good) { .. }
}