Skip to content

Commit

Permalink
fixup for builder commit
Browse files Browse the repository at this point in the history
  • Loading branch information
thesamet committed Dec 24, 2020
1 parent 85328c5 commit 906eb77
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,16 @@ trait JavaProtoSupport[ScalaPB, JavaPB] extends Any {
trait GeneratedMessageCompanion[A <: GeneratedMessage] {
type ValueType = A

type Builder <: MessageBuilder[A]

def merge(a: A, input: CodedInputStream): A

def parseFrom(input: CodedInputStream): A = newBuilder.merge(input).result
/** Parses a message from a CodedInputStream. */
// TODO(nadav): The implementation here should not rely on `newBuilder` for binary compatibility:
// Older 0.10.x generated code may not have it defined. In 0.10.x, the generated messages override
// this method. This can be eliminated in ScalaPB 0.11.0.
def parseFrom(input: CodedInputStream): A = merge(defaultInstance, input)

def parseFrom(input: InputStream): A = parseFrom(CodedInputStream.newInstance(input))

/** Returns a new empty Builder that can be used to build instances of this message */
def newBuilder: Builder

/** Returns a new Builder initialized from the given message */
def newBuilder(a: A): Builder

def parseDelimitedFrom(input: CodedInputStream): Option[A] =
LiteParser.parseDelimitedFrom(input)(this)

Expand Down

0 comments on commit 906eb77

Please sign in to comment.