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

java.time API: ChronoUnit::between does not specify possible exceptions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 8u40
    • core-libs
    • x86_64
    • windows_7

      A DESCRIPTION OF THE PROBLEM :
      The javadoc of the method "between" in java.time.temporal.ChronoUnit must specify the possible exceptions, i.e. it must copy the "Throws" part from the javadoc in TemporalUnit.

      To demonstrate that all 3 exceptions can effectively be thrown:

      ChronoUnit.MILLIS.between(Instant.MIN, Year.now());
      throws DateTimeException

      ChronoUnit.MILLIS.between(LocalDate.now(), LocalDate.now());
      throws UnsupportedTemporalTypeException

      ChronoUnit.MILLIS.between(Instant.MIN, Instant.MAX)
      throws ArithmeticException



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

            rpatil Ramanand Patil (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: