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

StableList throws the wrong exception type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 25
    • core-libs
    • None

      This code will throw NoSuchElementException instead of IndexOutOfBoundsException and will swallow the message because of the try/catch in ImmutableCollections.ListItr.next/previous:

      StableValue
          .list(42, _ -> {throw new IndexOutOfBoundsException("important message");})
          .listIterator(5)
          .next(); // same for previous()

            pminborg Per-Ake Minborg
            pminborg Per-Ake Minborg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: