On Thu, 29 Jan 2026 20:29:43 GMT, Roger Riggs <[email protected]> wrote:
>> Add missing cases to SpliteratorTraversingAndSplittingTest. This came up >> when I was fixing https://bugs.openjdk.org/browse/JDK-8372946, and I noticed >> the tests do not cover these sub-maps. >> >> Two interesting parts: >> >> 1. These tests failed when first added because `SubMapKeyIterator` and >> `DescendingSubMapKeyIterator` do not eagerly throw `NullPointerException` >> for `null` action arguments. The spec says "Throws: NullPointerException - >> if the specified action is null", so I updated the implementation to match >> other spliterators. >> 2. Since the descending maps have the reverse expected iteration order, I >> added support in the test harness for descending maps. > > src/java.base/share/classes/java/util/TreeMap.java line 2141: > >> 2139: } >> 2140: public void forEachRemaining(Consumer<? super K> action) { >> 2141: Objects.requireNonNull(action); > > Is there a test for NPE action on an empty Map? The new cases for subMap in SpliteratorTraversingAndSplittingTest should be sufficient. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29485#discussion_r2743414552
