Instant.ofEpochMilli says it can throw an exception that it can't

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 21
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • b21

      Instant.ofEpochMilli says this in its javadoc:

          * @throws DateTimeException if the instant exceeds the maximum or minimum instant

      But that can't actually happen:

      $ jshell
      | Welcome to JShell -- Version 21
      | For an introduction type: /help intro

      jshell> import java.time.Instant

      jshell> Instant.ofEpochMilli(Long.MAX_VALUE)
      $2 ==> +292278994-08-17T07:12:55.807Z

      jshell> Instant.ofEpochMilli(Long.MIN_VALUE)
      $3 ==> -292275055-05-16T16:47:04.192Z

            Assignee:
            Eamonn McManus
            Reporter:
            Eamonn McManus
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: