JDK-8306785 : fix deficient spliterators for Sequenced Collections
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 21
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-04-25
  • Updated: 2023-07-20
  • Resolved: 2023-07-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21 JDK 22
21Fixed 22 b07Fixed
Related Reports
Blocks :  
Description
Some spliterators need to be fixed up. In particular see these:

ReverseOrderDequeView
ReverseOrderListView

The spliterators for these views should be made late-binding and should potentially have some of the same characteristics of the spliterator of the backing collection.

In addition, some work could be done on spliterators of the reversed views of various array-based List concrete implementations, such as ArrayList, COWAL, Arrays.asList, and the unmodifiable lists. They could provide optimized overrides instead of simply inheriting the spliterator from ReverseOrderListView.
Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk21/pull/118 Date: 2023-07-13 05:45:37 +0000
13-07-2023

Changeset: 743e8b8e Author: Stuart Marks <smarks@openjdk.org> Date: 2023-07-12 23:45:42 +0000 URL: https://git.openjdk.org/jdk/commit/743e8b8e0a9fe032a0dd652a4fef1f761af66595
12-07-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14854 Date: 2023-07-12 17:25:03 +0000
12-07-2023

There is a lot of work that could be done on the spliterators, but it's too much to try to get it into JDK 21. Instead, for this bug I'll concentrate on safe and obvious improvements, which are to modify the default reverse-ordered views by replacing calls to spliteratorUnknownSize() with spliterator(Collection, ORDERED). Although the resulting spliterators will still be iterator-based, they will have a known size and will have the ORDERED characteristic -- which are moderate improvements. Further optimizations to enhance the reversed array-based collections with array-based and SIZED|SUBSIZED spliterators will be done later.
12-07-2023