简体   繁体   English

弃用方法,并链接到其他库中的类

[英]Deprecating a method, and linking to a class in a different library

I want to deprecate a method because I want to use a method from a different class in a different library (jar) that provides more standardization. 我想弃用一种方法,因为我想使用另一个库(jar)中另一个类的方法,该方法可提供更多的标准化。

What I'd like to write is something like this: 我想写的是这样的:

class MyClass {

/**
 * @deprecated use {@link com.othercompany.theirmodule.TheirClass.bar() }
 */
@Deprecated
void foo() {
...
}

However the class TheirClass belongs to another jar altogether. 但是,类TheirClass的类TheirClass属于另一个jar。 Must I add a dependency on their module just for the link in the javadoc 'deprecated' tag? 我是否必须仅在javadoc'deprecated'标记中的链接上为其模块添加依赖项?

@link is a javadoc tag. @link是一个javadoc标记。 It is used to generate documentation from source code with javadoc utility. 它用于使用javadoc实用程序从源代码生成文档。 It is also used by modern IDEs, eg Ctrl+Q in IntelliJ IDEA to display documentation about class/method under cursor. 现代IDE也使用它,例如IntelliJ IDEA中的Ctrl+Q ,以在光标下显示有关类/方法的文档。

But this is just a comment. 但这只是一条评论。 IDE may highlight it with red if ThierClass is not visible or does not have such method, but this is not an error for a compiler. 如果ThierClass不可见或没有这种方法,则IDE可能会用红色突出显示,但这对于编译器而言不是错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM