RFR-8148838: Stream.flatMap(...).spliterator() cannot properly split after tryAdvance()

Paul Sandoz paul.sandoz at oracle.com
Mon Feb 8 14:05:57 UTC 2016


> On 8 Feb 2016, at 14:53, Tagir F. Valeev <amaembo at gmail.com> wrote:
> 
> Hello!
> 
> PS>  188         public Spliterator<P_OUT> trySplit() {
> PS>  189             if (isParallel && !finished) {
> PS>  190                 init();
> PS>  191
> PS>  192                 if (buffer != null && buffer.count() > 0) // partial traversal started
> PS>  193                     return null;
> 
> PS> Why don’t you check if "buffer == null” at #189? i.e. similar to forEachRemaining:
> 
> That would make minimal behavioral change to fix this issue (fix
> flatMap keys only, but not affect other intermediate ops which were
> working correctly). Well, if buffer == null check is enough, here's
> update:
> 

Many thanks, yes it’s sufficient (finished == true when buffer != null && buffer.count() == 0).

Would you mind updating the date in the license headers and the test with the bug id. Then i will push. I forgot to tell you about those little things, see the following for one of your fixes i pushed with such updates (to avoid any email/review latency):

  http://hg.openjdk.java.net/jdk9/dev/jdk/rev/4a497e746019 <http://hg.openjdk.java.net/jdk9/dev/jdk/rev/4a497e746019>

Paul.


> http://cr.openjdk.java.net/~tvaleev/webrev/8148838/r4/
> (test unchanged)
> 
> With best regards,
> Tagir Valeev.
> 




More information about the core-libs-dev mailing list