Open
Description
Compiler version
3.1.2
Rrror: https://github.com/akka/akka/runs/8294129202?check_suite_focus=true
From: akka/akka#31345
Minimized code
Sorry I have not minimized it :(
def combine[T, U, M](
sources: java.util.List[_ <: Graph[SourceShape[T], _<: M]],
fanInGraph: Graph[UniformFanInShape[T, U], NotUsed]): Source[U, java.util.List[M]] = {
val seq = if (sources != null) Util.immutableSeq(sources).collect {
case source: Source[T @unchecked, M @unchecked] => source.asScala
case other => other
} else immutable.Seq()
import akka.util.ccompat.JavaConverters._
new Source(scaladsl.Source.combine(seq)(fanInGraph).mapMaterializedValue(_.asJava))
}
if I change to :
def combine[T, U, M](
sources: java.util.List[_ <: Graph[SourceShape[T], M]],
fanInGraph: Graph[UniformFanInShape[T, U], NotUsed]): Source[U, java.util.List[M]] = {
val seq = if (sources != null) Util.immutableSeq(sources).collect {
case source: Source[T @unchecked, M @unchecked] => source.asScala
case other => other
} else immutable.Seq()
import akka.util.ccompat.JavaConverters._
new Source(scaladsl.Source.combine(seq)(fanInGraph).mapMaterializedValue(_.asJava))
}
The only difference is _<:M
and M
.
Output
[error] -- [E007] Type Mismatch Error: /home/runner/work/akka/akka/akka-stream/src/main/scala/akka/stream/javadsl/Sink.scala:397:76
[error] 397 | new Sink(scaladsl.Sink.combine(seq)(fanoutGraph).mapMaterializedValue(_.asJava))
[error] | ^^^^^^^^
[error] | Found: java.util.List[Any]
[error] | Required: java.util.List[M]
[error] -- [E007] Type Mismatch Error: /home/runner/work/akka/akka/akka-stream/src/main/scala/akka/stream/javadsl/Source.scala:682:79
[error] 682 | new Source(scaladsl.Source.combine(seq)(fanInGraph).mapMaterializedValue(_.asJava))
[error] | ^^^^^^^^
[error] | Found: java.util.List[Any]
[error] | Required: java.util.List[M]
[error] two errors found
Expectation
Compile as Scala 2.
I think that should be computed to java.util.List[M]
not java.util.List[Any]