Skip to content

Commit

Permalink
post-review: drop redundant check; fix 2.13 compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
hugebdu committed Nov 29, 2023
1 parent 8575e52 commit 8d8256c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 8d8256c

Please sign in to comment.