[10] RFR 8193856 takeWhile produces incorrect result with elements produced by flatMap (original) (raw)
Paul Sandoz paul.sandoz at oracle.com
Wed Dec 20 21:28:16 UTC 2017
- Previous message: RFR [11] JDK-8179424: Remove terminally deprecated sun.reflect.Reflection.getCallerClass
- Next message: [10] RFR 8193856 takeWhile produces incorrect result with elements produced by flatMap
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
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.
—
Separately i plan to figure out a way to ensure flatMap operations become less aggressive if there are short-circuiting downstream operations. This may increase efficiency and also allow support for flat map results that are infinite.
Paul.
- Previous message: RFR [11] JDK-8179424: Remove terminally deprecated sun.reflect.Reflection.getCallerClass
- Next message: [10] RFR 8193856 takeWhile produces incorrect result with elements produced by flatMap
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]