JavaDoc @see for MyClass构造函数返回警告“未找到引用” [英] JavaDoc @see for MyClass constructor returning a warning "reference not found"

查看:480
本文介绍了JavaDoc @see for MyClass构造函数返回警告“未找到引用”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的客户端库创建javadoc。在MyOtherClass中,我把下面的@see,并得到警告。 MyOtherClass和MyClass都在不同的程序包中,在同一个项目中。

  @see MyClass#构造函数(Type1 param1,Type2 param2) 
warning - 标签@see:引用未找到:MyClass#构造函数(Type1 param1,Type2 param2)

然后我试过

  @see MyClass#MyClass(Type1 param1,Type2 param2)
warning - 请参阅:未找到引用:MyClass#MyClass(Type1 param1,Type2 param2)

还尝试了

  @see #MyClass(Type1 param1,Type2 param2)
warning - 标签@see:未找到引用:MyOtherClass#MyClass Type1 param1,Type2 param2)

我知道我在这里缺少一些真正的愚蠢。

解决方案

这是因为Javadoc需要知道您正在引用的类的确切位置来创建一个链接。只需添加如上述注释中所述的包。

  @see mypackage.MyClass#构造函数(Type1 p1,Type2 p2) 

javadoc工具将允许您按以下方式获取快捷方式:

  //对于同一类中的方法:
@see #Constructor(Type1 p1,Type2 p2)

// For同一个包中的方法:
@see MyClass#构造函数(Type1 p1,Type2 p2)

如果你有一个很长的包名,想要隐藏它,你可以使用一个标签:

  @see mypackage.MyClass#构造函数(Type1 p1,Type2 p2)MyClass#构造函数(Type1 p1,Type2 p2)

以上将显示:



另请参见: MyClass.Constructor(Type1 p1,Type2 p2) / p>

请参阅Oracle文档 here 了解更多关于@see的信息



警告:如果您使用某些IDE的代码完成功能(例如Eclipse)用于创建Javadoc注释,它可能为您引用的包添加一个导入。虽然这可能会使您的评论看起来更清洁,通过排除包名称,这不是纯粹的文档添加实际依赖关系的好习惯。


I am trying to create javadoc for my client library. In MyOtherClass, I put the the below @see , and get warnings. MyOtherClass and MyClass both are in different packages, in the same project.

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

Then I tried

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

Also tried

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

I know I am missing something real silly here.

解决方案

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.

这篇关于JavaDoc @see for MyClass构造函数返回警告“未找到引用”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆