[10] RFR 8193856 takeWhile produces incorrect result with elements produced by flatMap

Stuart Marks stuart.marks at oracle.com
Thu Dec 21 00:34:59 UTC 2017

On 12/20/17 1:28 PM, Paul Sandoz wrote:
> Please review this fix for a bug in the stream takeWhile operation:
>    http://cr.openjdk.java.net/~psandoz/jdk10/JDK-8193856-takeWhile-incorrect-results/webrev/ <http://cr.openjdk.java.net/~psandoz/jdk10/JDK-8193856-takeWhile-incorrect-results/webrev/>
> The flatMap operation is currently aggressive and does not detect if a downstream operation may or has cancelled processing, and will push all of it’s elements downstream. Short-circuiting operations should be guarded against such behaviour but unfortunately takeWhile was not guarded.

Hi Paul,

Change looks fine. Good to get this one into JDK 10.



More information about the core-libs-dev mailing list