Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8080449

doc for Object.toString should use @implSpec

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bchristi Brent Christian
              Reporter:
              smarks Stuart Marks
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: