JavaDoc中的`.`和`#`有什么区别?

JavaDoc中的`.`和`#`有什么区别?,java,javadoc,Java,Javadoc,我在上面的Javadoc方法中有这样一行: * {@link client.navigator.URLManager.newToken(NavigationToken)} Intellij IDEA analyzer将其突出显示为错误: 无法解析符号“client.navigator.URLManager.newToken” 但是如果我把改成就可以了 * {@link client.navigator.URLManager#newToken(NavigationToken)} 有什么区别?因

我在上面的Javadoc方法中有这样一行:

* {@link client.navigator.URLManager.newToken(NavigationToken)}
Intellij IDEA analyzer将其突出显示为错误:

无法解析符号“client.navigator.URLManager.newToken”

但是如果我把
改成
就可以了

* {@link client.navigator.URLManager#newToken(NavigationToken)}

有什么区别?因为我在项目中有很多地方有
#

将包的部分和包与类分开

#
将类名与字段、方法或构造函数分开


例如,在
client.navigator.URLManager#newToken
中,
client.navigator
是一个包,
URLManager
是一个类,
newToken
是方法名

甚至可以使用
#someMethod
引用当前类中的方法,而无需指定类(字段也是如此,…)


请注意,对于内部类,将有多个类名:
java.lang.Thread.State
是包
java.lang
中的一个内部类,它位于
Thread
内部,名为
State
。内部类和顶级类之间没有语法差异,识别这种差异的唯一方法(不查找类)是查看
Thread
是否大写,因此可能是一个类(但Java允许小写类和大写包,即使约定禁止).

Javadoc生成在构建链接时会注意
”#“
字符。链接可以指向其他Javadoc页面,也可以指向特定Javadoc页面中的某个位置

例如,这里有一个来自
Integer
“#”
的示例,其中包括这个Javadoc指令:
{@link java.lang.Integer#toString(int)}
。当生成Javadoc文件时,“link”指令将计算为HTML,该HTML指向“Integer.HTML”页面上的
toString()
方法(具体来说是:
https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#toString--
),因此您可以:

下面是另一个仅包含
字符(无
”#“
)的示例,其中有一个链接(
{@link java.text.Collator}
),该链接生成URL(
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/Collator.html
)这将转到:

*类{@code String}包含用于检查的方法
...
*除非另有说明,否则比较字符串的方法不采用区域设置
*考虑到。{@link java.text.Collator}类为
*更细粒度、对区域设置敏感的字符串比较。
...

client.navigator.URLManager
是类的完整路径,包括名为
client.navigator的包。就像您要在代码中导入它一样,比如
import client.navigator.URLManager
newToken
然而,Javadoc标准规定使用
#
来分离类及其方法。g
/**
 * Returns a {@code String} object representing this
 * {@code Integer}'s value. The value is converted to signed
 * decimal representation and returned as a string, exactly as if
 * the integer value were given as an argument to the {@link
 * java.lang.Integer#toString(int)} method.
 *
 * @return  a string representation of the value of this object in
 *          base 10.
 */
public String toString() {
    return toString(value);
}
 * The class {@code String} includes methods for examining

...

 * <p>Unless otherwise noted, methods for comparing Strings do not take locale
 * into account.  The {@link java.text.Collator} class provides methods for
 * finer-grain, locale-sensitive String comparison.

...