-
Bug
-
Resolution: Fixed
-
P4
-
None
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8135947 | emb-9 | Stuart Marks | P4 | Resolved | Fixed | team |
The specification for IntSummaryStatistics.toString is entirely copied from Object.toString:
==========
Description copied from class: Object
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 class Object 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())
==========
This copies the contract portion of Object.toString's spec, but it shouldn't copy the implementation portion of the specification. Thus, use of @implSpec combined with {@inheritDoc} is called for here. (SeeJDK-8080449 regarding Object.toString and JDK-8068562 regarding the @implSpec tag.)
In addition, the source code for IntSummaryStatistics.toString has this as its doc comment:
/**
* {@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.
*/
For some reason the text "Returns a non-empty string representation..." doesn't appear in the javadoc output. This may be a javadoc bug.
This is probably just one instance of a general problem where overriding methods' specifications should be cleaned up to inherit selectively from their superclass.
Seen on StackOverflow: http://stackoverflow.com/q/30244464/1441122
==========
Description copied from class: Object
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 class Object 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())
==========
This copies the contract portion of Object.toString's spec, but it shouldn't copy the implementation portion of the specification. Thus, use of @implSpec combined with {@inheritDoc} is called for here. (See
In addition, the source code for IntSummaryStatistics.toString has this as its doc comment:
/**
* {@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.
*/
For some reason the text "Returns a non-empty string representation..." doesn't appear in the javadoc output. This may be a javadoc bug.
This is probably just one instance of a general problem where overriding methods' specifications should be cleaned up to inherit selectively from their superclass.
Seen on StackOverflow: http://stackoverflow.com/q/30244464/1441122
- backported by
-
JDK-8135947 doc for Double/Int/LongSummaryStatistics.toString has errors
-
- Resolved
-
- relates to
-
JDK-8080449 doc for Object.toString should use @implSpec
-
- Closed
-