Open PhoenixmitX opened 1 week ago
The generated code by the sbt plugin does not support compiling with the -Yexplicit-nulls compiler option
-Yexplicit-nulls
Auto generated code does compile without errors when using -Yexplicit-nulls compiler option
add this to your build.sbt, and try to compile:
ThisBuild / scalacOptions += "-Yexplicit-nulls"
even an empty .proto file causes the compilation to fail
.proto
example log when trying to compile with one empty proto file
[error] 20 | com.google.protobuf.Descriptors.FileDescriptor.buildFrom(javaProto, _root_.scala.Array( [error] | ^ [error] | Found: com.google.protobuf.Descriptors#FileDescriptor | Null [error] | Required: com.google.protobuf.Descriptors.FileDescriptor [error] 21 | )) [error] | [error] | longer explanation available when compiling with `-explain` [warn] 9 | lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty [warn] | ^ [warn] |`_` is deprecated for wildcard arguments of types: use `?` instead [warn] |This construct can be rewritten automatically under -rewrite -source 3.4-migration.
That would require an adoption in upstream project
Pekko gRPC uses https://github.com/scalapb/ScalaPB under the hood to generate most of its source code. Maybe you could raise an issue there.
Problem
The generated code by the sbt plugin does not support compiling with the
-Yexplicit-nulls
compiler optionExpected behavior
Auto generated code does compile without errors when using
-Yexplicit-nulls
compiler optionSteps to reproduce
add this to your build.sbt, and try to compile:
even an empty
.proto
file causes the compilation to failexample log when trying to compile with one empty proto file