RFR: 8373243 : EnumSet.spliterator() should specify and document its characteristics [v3]

ExE Boss duke at openjdk.org
Fri Jan 9 01:01:41 UTC 2026


On Tue, 9 Dec 2025 11:17:18 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:
> 
>   Documenting that the EnumSet::spliterator() is non-fail-fast, and change implNote to implSpec

src/java.base/share/classes/java/util/EnumSet.java line 524:

> 522:      */
> 523:     @Override
> 524:     public final Spliterator<E> spliterator() {

Maybe keep this method non‑`final` so that specialised implementations may be provided by `SimpleEnumSet` or `JumboEnumSet` in the future without needing to remove the `final` modifier.
Suggestion:

    public Spliterator<E> spliterator() {

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28696#discussion_r2674414425


More information about the core-libs-dev mailing list