JavaDoc @see MyClass 构造函数返回警告“未找到引用”

2024-05-10

我正在尝试为我的客户端库创建 javadoc。在 MyOtherClass 中,我放置了下面的 @see ,并收到警告。 MyOtherClass 和 MyClass 都位于同一项目中的不同包中。

@see MyClass#Constructor(Type1 param1, Type2 param2)
warning - Tag @see: reference not found: MyClass#Constructor(Type1 param1, Type2 param2)

然后我尝试了

@see MyClass#MyClass(Type1 param1, Type2 param2) 
warning - Tag @see: reference not found: MyClass#MyClass(Type1 param1, Type2 param2)

也尝试过

@see #MyClass(Type1 param1, Type2 param2)
warning - Tag @see: reference not found: MyOtherClass#MyClass(Type1 param1, Type2 param2)

我知道我在这里错过了一些真正愚蠢的东西。


这是因为 Javadoc 需要知道您所引用的类的确切位置才能创建指向该类的链接。只需按照上面评论中提到的方式添加包即可。

@see mypackage.MyClass#Constructor(Type1 p1, Type2 p2)

javadoc 工具将允许您采用如下快捷方式:

// For methods in the same class:
@see #Constructor(Type1 p1, Type2 p2)

// For methods in the same package:
@see MyClass#Constructor(Type1 p1, Type2 p2)

如果你的包名称很长并且想隐藏它,你可以使用标签:

@see mypackage.MyClass#Constructor(Type1 p1, Type2 p2) MyClass#Constructor(Type1 p1, Type2 p2)

上面会显示:

也可以看看: MyClass.Constructor(Type1 p1, Type2 p2)

请参阅 Oracle 文档here http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#see有关@see的更多信息


Warning: If you use the code completion feature of some IDEs (E.g. Eclipse) for creating Javadoc comments it may add an import for the package you are referencing instead. While this may make your comments look cleaner by excluding the package name it is not good practice to add actual dependencies purely for documentation.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

JavaDoc @see MyClass 构造函数返回警告“未找到引用” 的相关文章

随机推荐