I am trying to generate Scala proto buff classes using Scalapb (https://scalapb.github.io/docs/scalapbc/). I am able to generate scala files but getting below error.
type arguments [com.huawei.utility.protobuff.embedtoRedis.embedtoRedis] do not conform to trait GeneratedMessageCompanion's type parameter bounds [A <: scalapb.GeneratedMessage with scalapb.Message[A]]
Sample.proto
syntax = "proto2";
package protobuff;
message embedtoRedis {
required int32 StudentID = 1;
repeated float StudentTitle = 2;
required string Class = 3;
optional string color = 4;
required string Type = 5;
}
After compiling using below command, i got two scala classes. ScalaPbc\scalapbc-0.11.1\bin>scalapbc.bat -v3.5.1 --scala_out=C:\Users\satheesh\Documents\ScalaPbc\new sample.proto
Scala classes: EmbedtoRedis.scala SampleProto.scala
I am facing the issue in embedToRedis.scala in the following lines.
object embedtoRedis extends scalapb.GeneratedMessageCompanion[protobuff.sample.embedtoRedis] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[protobuff.sample.embedtoRedis] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): protobuff.sample.embedtoRedis = {
var __requiredFields0: _root_.scala.Long = 0x7L
var __studentID: _root_.scala.Int = 0
val __studentTitle: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Float] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Float]
var ___class: _root_.scala.Predef.String = ""
var __color: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
var __type: _root_.scala.Predef.String = ""
Error: type arguments [com.huawei.utility.protobuff.embedtoRedis.embedtoRedis] do not conform to trait GeneratedMessageCompanion's type parameter bounds [A <: scalapb.GeneratedMessage with scalapb.Message[A]]
Can you please help if i am missing something?