The correct sequencing and respecting return values of `start` and `advance` is a precondition, and `NoSuchElementException` is the failure mode if the precondition isn't met. Documenting the behavior in the case of precondition failures is entirely reasonable. For example, look at Java's `Iterator` documentation, which has basically the same text: https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html
On Mon, Mar 12, 2018 at 9:20 AM Romain Manni-Bucau <rmannibu...@gmail.com> wrote: > I agree Thomas but I kind of read it as "yes we can drop that constraint". > If not we should also check we are used in a thread safe context etc which > will likely never hit the user sdk API so why doing that case a particular > case? Am I missing something? > > > Romain Manni-Bucau > @rmannibucau <https://twitter.com/rmannibucau> | Blog > <https://rmannibucau.metawerx.net/> | Old Blog > <http://rmannibucau.wordpress.com> | Github > <https://github.com/rmannibucau> | LinkedIn > <https://www.linkedin.com/in/rmannibucau> | Book > <https://www.packtpub.com/application-development/java-ee-8-high-performance> > > 2018-03-12 17:04 GMT+01:00 Thomas Groh <tg...@google.com>: > >> If a call to `getCurrentWhatever` happens after `start` or `advance` has >> returned false, it's a bug in the runner, but the reader needs to be able >> to fail, otherwise you'll get a synthetic element that doesn't really >> exist. If a reader throws `NoSuchElementException` after the most recent >> call returned true, the reader isn't conforming to spec. >> >> >> On Mon, Mar 12, 2018 at 9:00 AM Romain Manni-Bucau <rmannibu...@gmail.com> >> wrote: >> >>> Hi guys, >>> >>> why reader#getCurrent* can throw NoSuchElementException, >>> my understanding is that the runner will guarantee that start or advance >>> was called and returned true when calling getCurrent so this is a case >>> which shouldn't happen, no? >>> >>> Romain Manni-Bucau >>> @rmannibucau <https://twitter.com/rmannibucau> | Blog >>> <https://rmannibucau.metawerx.net/> | Old Blog >>> <http://rmannibucau.wordpress.com> | Github >>> <https://github.com/rmannibucau> | LinkedIn >>> <https://www.linkedin.com/in/rmannibucau> | Book >>> <https://www.packtpub.com/application-development/java-ee-8-high-performance> >>> >> >