pekko-grpc icon indicating copy to clipboard operation
pekko-grpc copied to clipboard

Support -Yexplicit-nulls compiler option

Open PhoenixmitX opened this issue 1 year ago • 2 comments

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.

PhoenixmitX avatar Jun 23 '24 01:06 PhoenixmitX

That would require an adoption in upstream project

He-Pin avatar Jun 23 '24 06:06 He-Pin

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.

pjfanning avatar Jun 23 '24 09:06 pjfanning

I'm closing this issue, as the upstream issue was marked as not planned.

PhoenixmitX avatar Sep 14 '24 18:09 PhoenixmitX