RFR(s): 8166446 SingletonIterator.forEachRemaining doesn't advance before calling action
Stuart Marks
stuart.marks at oracle.com
Wed Dec 7 01:20:26 UTC 2016
Thanks. Good ideas. I've renamed that method and adjusted it a bit.
s'marks
On 12/6/16 1:48 PM, Martin Buchholz wrote:
> Looks good.
>
> I've called similar methods assertIteratorExhausted instead of checkAtEnd.
> You could add
>
> it.forEachRemaining(e -> throw new AssertionError());
> to that method.
>
>
>
> On Tue, Dec 6, 2016 at 1:28 PM, Stuart Marks <stuart.marks at oracle.com
> <mailto:stuart.marks at oracle.com>> wrote:
>
> Hi all,
>
> Please review this small fix to adjust the behavior of
> SingletonIterator.forEachRemaining in the case where its action throws an
> exception:
>
> http://cr.openjdk.java.net/~smarks/reviews/8166446/webrev.0/
> <http://cr.openjdk.java.net/%7Esmarks/reviews/8166446/webrev.0/>
>
> Strictly speaking, this behavior is undefined (see the spec adjustment
> JDK-8168745 [1] [2] that Paul Sandoz pushed recently). However, we felt it
> was reasonable to make this case behave consistently with the default
> implementation of Iterator.forEachRemaining(), which advances before
> calling the action.
>
> Also, please ignore the extra changeset comment lines in the webrev.
> There's only one changeset here:
>
> rev 16204 : 8166446: SingletonIterator.forEachRemaining doesn't
> advance before calling action
>
> Something funny is up with webrev....
>
> Thanks,
>
> s'marks
>
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8168745
> <https://bugs.openjdk.java.net/browse/JDK-8168745>
>
> [2] http://hg.openjdk.java.net/jdk9/dev/jdk/rev/a563aaa85446
> <http://hg.openjdk.java.net/jdk9/dev/jdk/rev/a563aaa85446>
>
>
More information about the core-libs-dev
mailing list