From ff27e09d5b82e9c7b1bf824bf8badb8dfef1a21f Mon Sep 17 00:00:00 2001 From: He-Pin Date: Sun, 27 Aug 2023 17:56:57 +0800 Subject: [PATCH] -str Remove deprecated methods in GraphStage since 2.6.0 --- .../drop-deprecated-since-2.6.excludes | 18 ++++ .../scala/akka/stream/stage/GraphStage.scala | 89 +------------------ 2 files changed, 19 insertions(+), 88 deletions(-) create mode 100644 akka-stream/src/main/mima-filters/2.9.0.backwards.excludes/drop-deprecated-since-2.6.excludes diff --git a/akka-stream/src/main/mima-filters/2.9.0.backwards.excludes/drop-deprecated-since-2.6.excludes b/akka-stream/src/main/mima-filters/2.9.0.backwards.excludes/drop-deprecated-since-2.6.excludes new file mode 100644 index 00000000000..b9b1b0d7a4e --- /dev/null +++ b/akka-stream/src/main/mima-filters/2.9.0.backwards.excludes/drop-deprecated-since-2.6.excludes @@ -0,0 +1,18 @@ +# Dropping APIs deprecated since 2.6 +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.impl.fusing.ActorGraphInterpreter#BatchingActorInputBoundary.onDownstreamFinish") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.impl.fusing.PrefixAndTail#PrefixAndTailLogic.onDownstreamFinish") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.impl.io.ByteStringParser#ParsingLogic.onDownstreamFinish") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.scaladsl.MergeHub#MergedSourceLogic.onDownstreamFinish") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.AbstractInOutHandler.onDownstreamFinish") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.AbstractOutHandler.onDownstreamFinish") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.GraphStageLogic#ConditionalTerminateOutput.onDownstreamFinish") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.GraphStageLogic#EagerTerminateOutput.onDownstreamFinish") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.GraphStageLogic#Emitting.onDownstreamFinish") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.GraphStageLogic#IgnoreTerminateOutput.onDownstreamFinish") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.OutHandler.onDownstreamFinish") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.TimerGraphStageLogic.schedulePeriodicallyWithInitialDelay") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.TimerGraphStageLogic.schedulePeriodically") +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.TimerGraphStageLogic.schedulePeriodically") + +#for scala 3.2 +ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.GraphStageLogic.lastCancellationCause_=") diff --git a/akka-stream/src/main/scala/akka/stream/stage/GraphStage.scala b/akka-stream/src/main/scala/akka/stream/stage/GraphStage.scala index 8b8d0da5742..789f39b5dc8 100644 --- a/akka-stream/src/main/scala/akka/stream/stage/GraphStage.scala +++ b/akka-stream/src/main/scala/akka/stream/stage/GraphStage.scala @@ -683,13 +683,6 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: final def completeStage(): Unit = internalCompleteStage(SubscriptionWithCancelException.StageWasCompleted, OptionVal.None) - // Variable used from `OutHandler.onDownstreamFinish` to carry over cancellation cause in cases where - // `OutHandler` implementations call `super.onDownstreamFinished()`. - /** - * INTERNAL API - */ - @InternalApi private[stream] var lastCancellationCause: Throwable = _ - /** * Automatically invokes [[cancel]] or [[complete]] on all the input or output ports that have been called, * then marks the stage as stopped. @@ -1770,66 +1763,6 @@ abstract class TimerGraphStageLogic(_shape: Shape) extends GraphStageLogic(_shap scheduleAtFixedRate(timerKey, initialDelay.asScala, interval.asScala) } - /** - * Schedule timer to call [[#onTimer]] periodically with the given interval after the specified - * initial delay. - * Any existing timer with the same key will automatically be canceled before - * adding the new timer. - */ - @deprecated( - "Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as " + - "scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.", - since = "2.6.0") - final protected def schedulePeriodicallyWithInitialDelay( - timerKey: Any, - initialDelay: FiniteDuration, - interval: FiniteDuration): Unit = - scheduleAtFixedRate(timerKey, initialDelay, interval) - - /** - * Schedule timer to call [[#onTimer]] periodically with the given interval after the specified - * initial delay. - * Any existing timer with the same key will automatically be canceled before - * adding the new timer. - */ - @deprecated( - "Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as " + - "scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.", - since = "2.6.0") - final protected def schedulePeriodicallyWithInitialDelay( - timerKey: Any, - initialDelay: java.time.Duration, - interval: java.time.Duration): Unit = { - import akka.util.JavaDurationConverters._ - schedulePeriodicallyWithInitialDelay(timerKey, initialDelay.asScala, interval.asScala) - } - - /** - * Schedule timer to call [[#onTimer]] periodically with the given interval. - * Any existing timer with the same key will automatically be canceled before - * adding the new timer. - */ - @deprecated( - "Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as " + - "scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.", - since = "2.6.0") - final protected def schedulePeriodically(timerKey: Any, interval: FiniteDuration): Unit = - schedulePeriodicallyWithInitialDelay(timerKey, interval, interval) - - /** - * Schedule timer to call [[#onTimer]] periodically with the given interval. - * Any existing timer with the same key will automatically be canceled before - * adding the new timer. - */ - @deprecated( - "Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as " + - "scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.", - since = "2.6.0") - final protected def schedulePeriodically(timerKey: Any, interval: java.time.Duration): Unit = { - import akka.util.JavaDurationConverters._ - schedulePeriodically(timerKey, interval.asScala) - } - /** * Cancel timer, ensuring that the [[#onTimer]] is not subsequently called. * @@ -1893,21 +1826,6 @@ trait OutHandler { @throws(classOf[Exception]) def onPull(): Unit - /** - * Called when the output port will no longer accept any new elements. After this callback no other callbacks will - * be called for this port. - */ - @throws(classOf[Exception]) - @deprecatedOverriding("Override `def onDownstreamFinish(cause: Throwable)`, instead.", since = "2.6.0") // warns when overriding - @deprecated("Call onDownstreamFinish with a cancellation cause.", since = "2.6.0") // warns when calling - def onDownstreamFinish(): Unit = { - val thisStage = GraphInterpreter.currentInterpreter.activeStage - require( - thisStage.lastCancellationCause ne null, - "onDownstreamFinish() must not be called without a cancellation cause") - thisStage.cancelStage(thisStage.lastCancellationCause) - } - /** * Called when the output port will no longer accept any new elements. After this callback no other callbacks will * be called for this port. @@ -1915,12 +1833,7 @@ trait OutHandler { @throws(classOf[Exception]) def onDownstreamFinish(cause: Throwable): Unit = { val thisStage = GraphInterpreter.currentInterpreter.activeStage - try { - require(cause ne null, "Cancellation cause must not be null") - require(thisStage.lastCancellationCause eq null, "onDownstreamFinish(cause) must not be called recursively") - thisStage.lastCancellationCause = cause - (onDownstreamFinish(): @nowarn("msg=deprecated")) // if not overridden, call old deprecated variant - } finally thisStage.lastCancellationCause = null + thisStage.cancelStage(cause) } }