假设我有这样的东西:
public class MyClass {
private static MyClass sInstance;
/**
*
* @return The {@link MyClass} application instance.
*/
public static MyClass getInstance() {
return sInstance;
}
}
IntelliJ 给我这个警告:
'@link' pointing to containing class is unnecessary
编写这段 Javadoc 的正确/常规方法是什么?
你会怎么写?
最佳答案
在 JDK 中,他们使用 {@code}
。这不会产生可点击的链接,但您已经在查看无论如何都会链接的页面。
例如(来自 String.java ):
/**
* Initializes a newly created {@code String} object so that it represents
* the same sequence of characters as the argument; in other words, the
* newly created string is a copy of the argument string. Unless an
* explicit copy of {@code original} is needed, use of this constructor is
* unnecessary since Strings are immutable.
*
* @param original
* A {@code String}
*/
关于java - 如何为 getInstance 方法编写 Javadoc?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37047203/