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

java.time.Duration has wrong Javadoc Comments in toDays() and toHours()

    XMLWordPrintable

Details

    • b124
    • linux_ubuntu
    • Verified

    Backports

      Description

        A DESCRIPTION OF THE PROBLEM :
        The toDays() and toHours() methods in java.time.Duration have wrong Javadoc comments. They seem to be exact copies of the toMinutes() Javadoc, with only the number of seconds adjusted, but not the wording.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
            /**
             * Gets the number of days in this duration.
             * <p>
             * This returns the total number of days in the duration by dividing the
             * number of seconds by 86400.
             * This is based on the standard definition of a day as 24 hours.
             * <p>
             * This instance is immutable and unaffected by this method call.
             *
             * @return the number of days in the duration, may be negative
             */
            public long toDays() {
                return seconds / SECONDS_PER_DAY;
            }

            /**
             * Gets the number of hours in this duration.
             * <p>
             * This returns the total number of hours in the duration by dividing the
             * number of seconds by 3600.
             * <p>
             * This instance is immutable and unaffected by this method call.
             *
             * @return the number of hours in the duration, may be negative
             */
            public long toHours() {
                return seconds / SECONDS_PER_HOUR;
            }

            /**
             * Gets the number of minutes in this duration.
             * <p>
             * This returns the total number of minutes in the duration by dividing the
             * number of seconds by 60.
             * <p>
             * This instance is immutable and unaffected by this method call.
             *
             * @return the number of minutes in the duration, may be negative
             */
            public long toMinutes() {
                return seconds / SECONDS_PER_MINUTE;
            }
        ACTUAL -
            /**
             * Gets the number of minutes in this duration.
             * <p>
             * This returns the total number of minutes in the duration by dividing the
             * number of seconds by 86400.
             * This is based on the standard definition of a day as 24 hours.
             * <p>
             * This instance is immutable and unaffected by this method call.
             *
             * @return the number of minutes in the duration, may be negative
             */
            public long toDays() {
                return seconds / SECONDS_PER_DAY;
            }

            /**
             * Gets the number of minutes in this duration.
             * <p>
             * This returns the total number of minutes in the duration by dividing the
             * number of seconds by 3600.
             * <p>
             * This instance is immutable and unaffected by this method call.
             *
             * @return the number of minutes in the duration, may be negative
             */
            public long toHours() {
                return seconds / SECONDS_PER_HOUR;
            }

            /**
             * Gets the number of minutes in this duration.
             * <p>
             * This returns the total number of minutes in the duration by dividing the
             * number of seconds by 60.
             * <p>
             * This instance is immutable and unaffected by this method call.
             *
             * @return the number of minutes in the duration, may be negative
             */
            public long toMinutes() {
                return seconds / SECONDS_PER_MINUTE;
            }

        URL OF FAULTY DOCUMENTATION :
        http://download.java.net/jdk8/docs/api/java/time/Duration.html

        Attachments

          Issue Links

            Activity

              People

                rriggs Roger Riggs
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: