Incomplete Javadoc in Java 8?
javadocs for Java is the 8不完全?P></
方法对omitted are some of the method and the description is copied from a(incorrectly)基础类(例如toString()java.util.intsummarystatistics the method with the笔记"description copied from class对象"。P></
1Description copied from class:
Object Returns a string representation of the object. In
general, thetoString method returns a string that
"textually represents" this object. The result should be a concise
but informative representation that is easy for a person to read. It
is recommended that all subclasses override this method.The
toString method for classObject returns a
string consisting of the name of the class of which the object is an
instance, the at-sign character '@', and the unsigned
hexadecimal representation of the hash code of the object. In other
words, this method returns a string equal to the value of:
1Overrides:
toString in classObject Returns:
a string representation of the object.
the actual
1 | IntSummaryStatistics{count=10, sum=129, min=2, average=12.900000, max=29} |
默认的类和对象inherited not the from here,as shown。P></
是的,这里有几个不同的问题。
Returns a string representation of the object. In general, the
toString method returns a string that"textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
号
这表示
从
The
toString method for classObject returns a string consisting of the name of the class of which the object is an instance, the at-sign character '@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
号
这是正确的,但不相关,因为它在
问题是,在
直到JDK8没有办法将它们分开,所以文本要么是手工复制(导致不一致),要么是使用
新的标签记录在这个信息性的jep中。注意,这些标签是JDK特有的,还不能用于JDK之外的JavaDoc。
还有一件丢失了。
1 2 3 4 5 6 7 8 9 | @Override /** * {@inheritDoc} * * Returns a non-empty string representation of this object suitable for * debugging. The exact presentation format is unspecified and may vary * between implementations and versions. */ public String toString() { ... |
不幸的是,文本"返回非空字符串表示…"没有出现在JavaDoc输出中。我觉得这是另一个错误。编辑:错误是注释在
我已经提交了JDK-80449和JDK-8080450来涵盖这些问题。
我想说你是对的,这里有什么问题。此toString()方法记录在InSummaryStatistics JavaDoc页上。它没有在"从类对象派生的方法"链接中引用。所以我想说,如果这个方法的行为与object.toString()不同,那么应该记录该行为。
我不同意称这是"错误的"。但它误导了类
我认为这部分不应该被复制。这是误导性的,并没有添加可利用的信息。
但我完全同意这种形式的文档有点"不正确",对于这样的公共API来说是不值得的。即使没有任何文档比这个文档更好。