diff --git a/libraries/stdlib/src/kotlin/support/AbstractIterator.kt b/libraries/stdlib/src/kotlin/support/AbstractIterator.kt index 436998cdd39..8aabef146ca 100644 --- a/libraries/stdlib/src/kotlin/support/AbstractIterator.kt +++ b/libraries/stdlib/src/kotlin/support/AbstractIterator.kt @@ -5,11 +5,12 @@ import java.util.NoSuchElementException // TODO should not need this - its here for the JS stuff import java.lang.UnsupportedOperationException -public enum class State { - Ready - NotReady - Done - Failed +// not using an enum for now as JS generation doesn't support it +public object State { + val Ready = 0 + val NotReady = 1 + val Done = 2 + val Failed = 3 } /** @@ -17,7 +18,7 @@ public enum class State { * to implement the iterator, calling [[done()]] when the iteration is complete. */ public abstract class AbstractIterator: java.util.Iterator { - private var state: State = State.NotReady + private var state = State.NotReady private var next: T? = null override fun hasNext(): Boolean { @@ -111,7 +112,7 @@ class CompositeIterator(vararg iterators: java.util.Iterator): AbstractIte val iter = currentIter if (iter != null) { if (iter.hasNext()) { - setNext(iter.next()) + setNext(iter.next()!!) return } else { currentIter = null