RFR: 8373243 : EnumSet.spliterator() should specify and document its characteristics [v3]
Viktor Klang
vklang at openjdk.org
Tue Jan 27 15:48:49 UTC 2026
On Fri, 9 Jan 2026 00:57:39 GMT, ExE Boss <duke at openjdk.org> wrote:
>> 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() {
On the contrary, I think adding `final` here serves as a good indicator to anyone possibly wanting to override spliterator() that they need to consider the behavior of the superclass' implementation. AS EnumSet is `sealed` there is no risk to non-jdk code and dropping the `final`-modifier later is trivial.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28696#discussion_r2732655652
More information about the core-libs-dev
mailing list