RFR: CODETOOLS-7902840: JMH: Fix *Statistics iterators to throw NoSuchElementException properly

Aleksey Shipilev shade at openjdk.java.net
Tue Mar 9 14:56:25 UTC 2021


SonarCloud instance reports:
 Add a "NoSuchElementException" for iteration beyond the end of the collection.

...in places like:

        @Override
        public Map.Entry<Double, Long> next() {
            return new AbstractMap.SimpleImmutableEntry<>(values[currentIndex++], 1L);
        }

        @Override
        public Map.Entry<Double, Long> next() {
            entryReturned = true;
            return new AbstractMap.SimpleImmutableEntry<>(value, 1L);
        }

-------------

Commit messages:
 - CODETOOLS-7902840: JMH: Fix *Statistics iterators to throw NoSuchElementException properly

Changes: https://git.openjdk.java.net/jmh/pull/27/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jmh&pr=27&range=00
  Issue: https://bugs.openjdk.java.net/browse/CODETOOLS-7902840
  Stats: 46 lines in 5 files changed: 44 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jmh/pull/27.diff
  Fetch: git fetch https://git.openjdk.java.net/jmh pull/27/head:pull/27

PR: https://git.openjdk.java.net/jmh/pull/27


More information about the jmh-dev mailing list