make RunnableGraph.addAttributes return a RunnableGraph #20630

This commit is contained in:
Tim Harper 2016-05-25 20:38:36 -06:00 committed by Johan Andrén
parent bb701d1725
commit 1c6b38743b
3 changed files with 16 additions and 7 deletions

View file

@ -1919,12 +1919,6 @@ object RunnableGraph {
if (newRunnable eq runnable) this
else new RunnableGraphAdapter(newRunnable)
}
override def named(name: String): RunnableGraphAdapter[Mat] = {
val newRunnable = runnable.named(name)
if (newRunnable eq runnable) this
else new RunnableGraphAdapter(newRunnable)
}
}
}
/**
@ -1942,4 +1936,12 @@ abstract class RunnableGraph[+Mat] extends Graph[ClosedShape, Mat] {
* Transform only the materialized value of this RunnableGraph, leaving all other properties as they were.
*/
def mapMaterializedValue[Mat2](f: function.Function[Mat, Mat2]): RunnableGraph[Mat2]
override def withAttributes(attr: Attributes): RunnableGraph[Mat]
override def addAttributes(attr: Attributes): RunnableGraph[Mat] =
withAttributes(module.attributes and attr)
override def named(name: String): RunnableGraph[Mat] =
withAttributes(Attributes.name(name))
}

View file

@ -350,6 +350,9 @@ final case class RunnableGraph[+Mat](val module: StreamLayout.Module) extends Gr
*/
def run()(implicit materializer: Materializer): Mat = materializer.materialize(this)
override def addAttributes(attr: Attributes): RunnableGraph[Mat] =
withAttributes(module.attributes and attr)
override def withAttributes(attr: Attributes): RunnableGraph[Mat] =
new RunnableGraph(module.withAttributes(attr))

View file

@ -927,7 +927,11 @@ object MiMa extends AutoPlugin {
// #
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.HttpEntity.discardBytes"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.scaladsl.model.HttpEntity.discardBytes")
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.scaladsl.model.HttpEntity.discardBytes"),
// #20630 corrected return types of java methods
ProblemFilters.exclude[IncompatibleResultTypeProblem]("akka.stream.javadsl.RunnableGraph#RunnableGraphAdapter.named"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.stream.javadsl.RunnableGraph.withAttributes")
)
)
}