On Jun 15, 2015, at 6:34 PM, Martin Buchholz <[email protected]> wrote:
> Staring at LinkedTransferQueue.java, I see:
>
> return Spliterators.spliterator
> (a, 0, i, (Spliterator.ORDERED |
> Spliterator.NONNULL |
> Spliterator.CONCURRENT));
>
> but ... that's a spliterator over an immutable array, so shouldn't we have
> IMMUTABLE instead of CONCURRENT?
>
The intent here is that the sub-spliterators "inherit" certain characteristics
of their top-level spliterator or source, rather than from that which might be
derived from an internal data structure used to hold a partitioned set of
elements.
Note that the specification of Spliterator.CONCURRENT allows for
sub-spliterators to report SIZED/SUBSIZED.
Paul.
> Looking further, I see ArraySpliterator requires its input array to be
> unmodified during operation
>
> * @param array the array, assumed to be unmodified during use
>
> ("assumed" is weird in javadoc. maybe "required"?)
>
> but ArraySpliterator does not include IMMUTABLE in characteristics, even
> though Arrays.spliterator does.
>
> I suggest fixing all these array spliterator characteristics to always report
> IMMUTABLE and never report CONCURRENT, and to document this fact, as we
> already do with SIZED and SUBSIZED.