diff --git a/scalapb-runtime-grpc/src/main/scala/scalapb/grpc/Marshaller.scala b/scalapb-runtime-grpc/src/main/scala/scalapb/grpc/Marshaller.scala index ee41110ca..a2d8eada4 100644 --- a/scalapb-runtime-grpc/src/main/scala/scalapb/grpc/Marshaller.scala +++ b/scalapb-runtime-grpc/src/main/scala/scalapb/grpc/Marshaller.scala @@ -6,10 +6,10 @@ import scalapb.{GeneratedMessage, GeneratedMessageCompanion, TypeMapper} class Marshaller[T <: GeneratedMessage](companion: GeneratedMessageCompanion[T]) extends io.grpc.MethodDescriptor.Marshaller[T] { - override def stream(t: T): InputStream = new ProtoInputStream[T](t, this) + override def stream(t: T): InputStream = new ProtoInputStream[T](t) override def parse(inputStream: InputStream): T = inputStream match { - case pis: ProtoInputStream[T] if pis.marshaller == this => pis.message + case pis: ProtoInputStream[_] => pis.message.asInstanceOf[T] case _ => companion.parseFrom(inputStream) } } diff --git a/scalapb-runtime-grpc/src/main/scala/scalapb/grpc/ProtoInputStream.scala b/scalapb-runtime-grpc/src/main/scala/scalapb/grpc/ProtoInputStream.scala index a892dc433..1583845ef 100644 --- a/scalapb-runtime-grpc/src/main/scala/scalapb/grpc/ProtoInputStream.scala +++ b/scalapb-runtime-grpc/src/main/scala/scalapb/grpc/ProtoInputStream.scala @@ -9,7 +9,7 @@ import java.io.{ByteArrayInputStream, InputStream} * Allows skipping serialization completely when the io.grpc.inprocess.InProcessTransport is used. * Inspired by https://github.com/grpc/grpc-java/blob/master/protobuf-lite/src/main/java/io/grpc/protobuf/lite/ProtoInputStream.java */ -class ProtoInputStream[T <: GeneratedMessage](msg: T, val marshaller: Marshaller[T]) extends InputStream { +class ProtoInputStream[T <: GeneratedMessage](msg: T) extends InputStream { private var state: State = Message(msg)