The doc comment for Object.toString is as follows:
/**
* Returns a string representation of the object. In general, the
* {@code 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.
* <p>
* The {@code toString} method for class {@code Object}
* returns a string consisting of the name of the class of which the
* object is an instance, the at-sign character `{@code @}', 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:
* <blockquote>
* <pre>
* getClass().getName() + '@' + Integer.toHexString(hashCode())
* </pre></blockquote>
*
* @return a string representation of the object.
*/
There are really two parts here: API specification and implementation specification. The latter should be demarcated using the @implSpec tag. See JDK-8068562.
This is a general issue; I'm sure there are many other cases that apply elsewhere along with the specific instance of Object.toString.
Seen on StackOverflow: http://stackoverflow.com/q/30244464/1441122
/**
* Returns a string representation of the object. In general, the
* {@code 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.
* <p>
* The {@code toString} method for class {@code Object}
* returns a string consisting of the name of the class of which the
* object is an instance, the at-sign character `{@code @}', 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:
* <blockquote>
* <pre>
* getClass().getName() + '@' + Integer.toHexString(hashCode())
* </pre></blockquote>
*
* @return a string representation of the object.
*/
There are really two parts here: API specification and implementation specification. The latter should be demarcated using the @implSpec tag. See JDK-8068562.
This is a general issue; I'm sure there are many other cases that apply elsewhere along with the specific instance of Object.toString.
Seen on StackOverflow: http://stackoverflow.com/q/30244464/1441122
- duplicates
-
JDK-8261123 Augment discussion of equivalence classes in Object.equals and comparison methods
- Resolved
- relates to
-
JDK-8068562 javadoc tags to distinguish API, implementation, specification, and notes
- Draft
-
JDK-8080450 doc for Double/Int/LongSummaryStatistics.toString has errors
- Closed