@@ -50,49 +50,49 @@ private[flow] final class StreamSubscriber[F[_], A] private (
5050 // Subscriber API.
5151
5252 /** Receives a subscription from the upstream reactive-streams system. */
53- override def onSubscribe (subscription : Subscription ): Unit = {
53+ override final def onSubscribe (subscription : Subscription ): Unit = {
5454 requireNonNull(
5555 subscription,
5656 " The subscription provided to onSubscribe must not be null"
5757 )
58- nextState(Subscribe (subscription))
58+ nextState(input = Subscribe (subscription))
5959 }
6060
6161 /** Receives the next record from the upstream reactive-streams system. */
62- override def onNext (a : A ): Unit = {
62+ override final def onNext (a : A ): Unit = {
6363 requireNonNull(
6464 a,
6565 " The element provided to onNext must not be null"
6666 )
67- nextState(Next (a))
67+ nextState(input = Next (a))
6868 }
6969
7070 /** Called by the upstream reactive-streams system when it fails. */
71- override def onError (ex : Throwable ): Unit = {
71+ override final def onError (ex : Throwable ): Unit = {
7272 requireNonNull(
7373 ex,
7474 " The throwable provided to onError must not be null"
7575 )
76- nextState(Error (ex))
76+ nextState(input = Error (ex))
7777 }
7878
7979 /** Called by the upstream reactive-streams system when it has finished sending records. */
80- override def onComplete (): Unit =
81- nextState(Complete (canceled = false ))
80+ override final def onComplete (): Unit =
81+ nextState(input = Complete (canceled = false ))
8282
8383 // Interop API.
8484
8585 /** Creates a downstream [[Stream ]] from this [[Subscriber ]]. */
8686 private [flow] def stream (subscribe : F [Unit ]): Stream [F , A ] = {
8787 // Called when downstream has finished consuming records.
8888 val finalize =
89- F .delay(nextState(Complete (canceled = true )))
89+ F .delay(nextState(input = Complete (canceled = true )))
9090
9191 // Producer for downstream.
9292 val dequeue1 =
9393 F .async[Option [Chunk [Any ]]] { cb =>
9494 F .delay {
95- nextState(Dequeue (cb))
95+ nextState(input = Dequeue (cb))
9696
9797 Some (finalize)
9898 }
@@ -112,8 +112,8 @@ private[flow] final class StreamSubscriber[F[_], A] private (
112112 private def run (block : => Unit ): () => Unit = () => block
113113
114114 /** Runs a single step of the state machine. */
115- private def step (in : Input ): State => (State , () => Unit ) =
116- in match {
115+ private def step (input : Input ): State => (State , () => Unit ) =
116+ input match {
117117 case Subscribe (s) => {
118118 case Uninitialized (None ) =>
119119 Idle (s) -> noop
@@ -263,9 +263,9 @@ private[flow] final class StreamSubscriber[F[_], A] private (
263263 * + `Error` & `Dequeue`: No matter the order in which they are processed, we will complete the callback with the error.
264264 * + cancellation & any other thing: Worst case, we will lose some data that we not longer care about; and eventually reach `Terminal`.
265265 */
266- private def nextState (in : Input ): Unit = {
266+ private def nextState (input : Input ): Unit = {
267267 val (_, effect) = currentState.updateAndGet { case (state, _) =>
268- step(in )(state)
268+ step(input )(state)
269269 }
270270 // Only run the effect after the state update took place.
271271 effect()
0 commit comments