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

Javadocs for java.time.Instant until(Temporal endExclusive, TemporalUnit unit) contains typo

XMLWordPrintable

    • b112
    • x86
    • other

      A DESCRIPTION OF THE PROBLEM :
      The Javadocs for the java.time.Instant class currently contains the following sentence within the description of the until(Temporal endExclusive, TemporalUnit unit) method:
      "For example, the amount in days between two dates can be calculated using startInstant.until(endInstant, SECONDS)."

      This is incorrect. It is stating that the example calculates the days between two Instants, but really it calculates the seconds between the two Instants.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      "... For example, the amount in seconds between two dates can be calculated using startInstant.until(endInstant, SECONDS). ..."

      OR

      "... For example, the amount in days between two dates can be calculated using startInstant.until(endInstant, DAYS). ..."
      ACTUAL -
      "... For example, the amount in days between two dates can be calculated using startInstant.until(endInstant, SECONDS). ..."


      URL OF FAULTY DOCUMENTATION :
      https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html#until-java.time.temporal.Temporal-java.time.temporal.TemporalUnit-

            aroy Abhijit Roy (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: