apache / pekko-grpc

Apache Pekko gRPC
https://pekko.apache.org/
Apache License 2.0
37 stars 16 forks source link

Support -Yexplicit-nulls compiler option #335

Open PhoenixmitX opened 1 week ago

PhoenixmitX commented 1 week ago

Problem

The generated code by the sbt plugin does not support compiling with the -Yexplicit-nulls compiler option

Expected behavior

Auto generated code does compile without errors when using -Yexplicit-nulls compiler option

Steps to reproduce

add this to your build.sbt, and try to compile:

ThisBuild / scalacOptions += "-Yexplicit-nulls"

even an empty .proto file causes the compilation to fail

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.
He-Pin commented 1 week ago

That would require an adoption in upstream project

pjfanning commented 1 week ago

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.