akka-stream compiler warnings as fatal errors (#26673)
This commit is contained in:
parent
6207484c0e
commit
7e7901ad49
53 changed files with 276 additions and 183 deletions
|
|
@ -18,19 +18,21 @@ import akka.stream.impl.{ ReactiveStreamsCompliance, Buffer => BufferImpl }
|
|||
import akka.stream.scaladsl.{ Flow, Keep, Source }
|
||||
import akka.stream.stage._
|
||||
import akka.stream.{ Supervision, _ }
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import scala.collection.immutable
|
||||
import scala.collection.immutable.VectorBuilder
|
||||
import scala.concurrent.{ Future, Promise }
|
||||
import scala.util.control.{ NoStackTrace, NonFatal }
|
||||
import scala.util.{ Failure, Success, Try }
|
||||
|
||||
import akka.stream.ActorAttributes.SupervisionStrategy
|
||||
|
||||
import scala.concurrent.duration.{ FiniteDuration, _ }
|
||||
import scala.util.control.Exception.Catcher
|
||||
|
||||
import akka.stream.impl.Stages.DefaultAttributes
|
||||
import akka.util.OptionVal
|
||||
import akka.util.unused
|
||||
import com.github.ghik.silencer.silent
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
|
|
@ -473,7 +475,7 @@ private[stream] object Collect {
|
|||
})
|
||||
}
|
||||
|
||||
private def onRestart(t: Throwable): Unit = {
|
||||
private def onRestart(): Unit = {
|
||||
current = zero
|
||||
elementHandled = false
|
||||
}
|
||||
|
|
@ -498,7 +500,7 @@ private[stream] object Collect {
|
|||
case Supervision.Stop => failStage(t)
|
||||
case Supervision.Resume => safePull()
|
||||
case Supervision.Restart =>
|
||||
onRestart(t)
|
||||
onRestart()
|
||||
safePull()
|
||||
}
|
||||
elementHandled = true
|
||||
|
|
@ -531,7 +533,7 @@ private[stream] object Collect {
|
|||
case NonFatal(ex) =>
|
||||
decider(ex) match {
|
||||
case Supervision.Stop => failStage(ex)
|
||||
case Supervision.Restart => onRestart(ex)
|
||||
case Supervision.Restart => onRestart()
|
||||
case Supervision.Resume => ()
|
||||
}
|
||||
tryPull(in)
|
||||
|
|
@ -629,7 +631,7 @@ private[stream] object Collect {
|
|||
private var aggregator: Out = zero
|
||||
private var aggregating: Future[Out] = Future.successful(aggregator)
|
||||
|
||||
private def onRestart(t: Throwable): Unit = {
|
||||
private def onRestart(@unused t: Throwable): Unit = {
|
||||
aggregator = zero
|
||||
}
|
||||
|
||||
|
|
@ -1407,6 +1409,7 @@ private[stream] object Collect {
|
|||
private lazy val self = getStageActor {
|
||||
case (_, Terminated(`targetRef`)) =>
|
||||
failStage(new WatchedActorTerminatedException("Watch", targetRef))
|
||||
case (_, _) => // keep the compiler happy (stage actor receive is total)
|
||||
}
|
||||
|
||||
override def preStart(): Unit = {
|
||||
|
|
@ -1886,7 +1889,7 @@ private[stream] object Collect {
|
|||
new GraphStageLogic(shape) with InHandler with OutHandler { self =>
|
||||
override def toString = s"Reduce.Logic(aggregator=$aggregator)"
|
||||
|
||||
var aggregator: T = _
|
||||
private var aggregator: T = _
|
||||
|
||||
private def decider =
|
||||
inheritedAttributes.mandatoryAttribute[SupervisionStrategy].decider
|
||||
|
|
@ -1905,6 +1908,7 @@ private[stream] object Collect {
|
|||
})
|
||||
}
|
||||
|
||||
@silent // compiler complaining about aggregator = _: T
|
||||
override def onPush(): Unit = {
|
||||
val elem = grab(in)
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue