RFR: 8376698: Add Spliterator tests for TreeMap sub-maps

Roger Riggs rriggs at openjdk.org
Thu Jan 29 22:26:01 UTC 2026


On Thu, 29 Jan 2026 20:33:47 GMT, Chen Liang <liach at openjdk.org> wrote:

>> 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.

I'd rather see it tested explicitly; its hard to identify exactly which test expects and catches the NPE.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29485#discussion_r2743794120


More information about the core-libs-dev mailing list