RFR: 8373243 : EnumSet.spliterator() should specify and document its characteristics [v2]
Patrick Strawderman
duke at openjdk.org
Tue Dec 9 06:18:57 UTC 2025
On Tue, 9 Dec 2025 01:18:48 GMT, Viktor Klang <vklang at openjdk.org> wrote:
>> Addresses https://bugs.openjdk.org/browse/JDK-8373243 by copying and adapting the specification from https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/LinkedHashSet.java#L186-L204
>>
>> Since EnumSet is sealed and only permits two final classes, the verbiage around "Implementations should document the reporting of additional characteristic values." may be considered to get removed from this PR. Kept, for now, for symmetry reasons.
>
> Viktor Klang has updated the pull request incrementally with one additional commit since the last revision:
>
> Removing verbiage around implementations documenting additional characteristics as well as making EnumSet::spliterator() final
src/java.base/share/classes/java/util/EnumSet.java line 507:
> 505: /**
> 506: * Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
> 507: * and <em>fail-fast</em> {@code Spliterator} over the elements in this set.
I don't think the `EnumSet` spliterator is fail-fast, since its iterator is [weakly consistent](https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/EnumSet.java#L41-L46).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28696#discussion_r2601245522
More information about the core-libs-dev
mailing list