为什么Oracle JDK的Javadoc中没有包含严格的浮点数修饰符?

huangapple go评论78阅读模式
英文:

Why does the Oracle JDK Javadoc not include the strict floating point modifier?

问题

如果我在 NetBeans 的 Javadoc 窗口中查看 StrictMath.toRadians(),前两行内容如下:

java.lang.StrictMath
public static strictfp double toRadians(double angdeg)

这是有道理的,因为我使用的 JDK 中 StrictMath.toRadians() 带有 strictfp 修饰符。然而,如果我在在线的 StrictMath Javadoc 中查看,对于 strictfp 完全没有提及。例如,toRadians() Javadoc 的首行内容如下:

public static double toRadians(double angdeg)

我使用的是 JDK 1.8.0_241,运行时略领先。相当确定这是 Oracle JDK。据我所知,JDK 源代码中 StrictMath 的 Javadoc 注释与上面链接的 Oracle 页面中的内容相符。

是 Javadoc 工具忽略了 strictfp 修饰符,还是 Oracle 故意从生成的 StrictMath Javadoc HTML 页面中去掉了它?

(我尝试为一个虚拟的 strictfp 函数生成 Javadoc,但在我尝试做的那个项目中出现了许多看似无关的 Javadoc 错误)。

英文:

If I look at the StrictMath.toRadians() in the NetBeans Javadoc window, the top two lines read

java.​lang.​StrictMath
public static strictfp double toRadians(double angdeg)

That makes sense, since the JDK I'm using has StrictMath.toRadians() defined with the strictfp modifier. However, if I look at the StrictMath Javadoc online, I see no mention whatsoever of strictfp. The top line of the toRadians() Javadoc, for example, reads

public static double toRadians(double angdeg)

I'm using the JDK 1.8.0_241, the runtime is slightly ahead. Fairly certain it's the Oracle JDK. As far as I can tell, the Javadoc comments in the JDK source for StrictMath match what is posted in the Oracle page linked above.

Is it that the Javadoc tool ignores the strictfp modifier or is it that Oracle deliberately took it out of the generated StrictMath Javadoc HTML pages?

(I tried to generate Javadoc for a dummy strictfp function, but it seems I've got a whole bunch of seemingly unrelated Javadoc errors in the project I tried to do that in).

答案1

得分: 3

根据Java 8的javadoc文档所述:

> javadoc命令可以包括修饰符publicprotectedprivateabstractfinalstatictransientvolatile,但不包括synchronizednativesynchronizednative修饰符被视为实现细节,不属于API规范的一部分。

文档没有明确列出strictfp,但由于strictfp是影响方法实现而不是使用方式的特性,因此出于这个原因被排除在外。

英文:

As the documentation of javadoc for Java 8 says:

> The javadoc command can include the modifiers public, protected, private, abstract, final, static, transient, and volatile, but not synchronized or native. The synchronized and native modifiers are considered implementation detail and not part of the API specification.

It doesn't explicitly list strictfp, but since strictfp is a feature that affects the implementation of the method, not how it is used, it is excluded for that reason.

huangapple
  • 本文由 发表于 2020年10月17日 12:38:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/64399055.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定