RFR: 8179918: EnumSet spliterator should report SORTED, ORDERED, NONNULL [v3]

Patrick Strawderman duke at openjdk.org
Tue Dec 2 23:35:36 UTC 2025


On Tue, 2 Dec 2025 16:00:42 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> Patrick Strawderman has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add unit test
>
> test/jdk/java/util/EnumSet/EnumSetSpliteratorTest.java line 79:
> 
>> 77:         assertTrue(spliterator.hasCharacteristics(Spliterator.SORTED), "Missing SORTED");
>> 78:         assertTrue(spliterator.hasCharacteristics(Spliterator.ORDERED), "Missing ORDERED");
>> 79:         assertTrue(spliterator.hasCharacteristics(Spliterator.NONNULL), "Missing NONNULL");
> 
> Thanks for adding the test. I think it makes sense to check the `enumSet.spliterator().characteristics()` being exactly `DISTINCT | SORTED | ORDERED | NONNULL` (since this test otherwise would still pass if further characteristics are added).

Okay, I also check for SIZED / SUBSIZED since those get added by `Spliterators.spliterator`. I left each check split out though to make it easier to see exactly why the test fails if there's a regression.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28568#discussion_r2583116248


More information about the core-libs-dev mailing list