JavaDoc @see for MyClass constructor returning a warning “reference not found”

99封情书 提交于 2019-12-05 06:18:12

This is because the Javadoc needs to know the exact location of the class you are referencing to create a link to it. Simply add the package as was mentioned in a comment above.

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

The javadoc tool will allow you to take shortcuts as follows:

// 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)

If you have a long package name and want to hide it you can use a label:

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

The above will display:

See Also: MyClass.Constructor(Type1 p1, Type2 p2)

See the Oracle documentation here for more on @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.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!