grpc-java
grpc-java copied to clipboard
protoc-gen-grpc-java: support edition 2023
Is your feature request related to a problem?
I'm trying to generate Java classes from proto file using edition="2023" syntax. It works with protoc when no plugin is enabled, but once I add java plugin I get this error:
./protoc-4.28.1-linux-x86_64.exe --plugin=protoc-gen-grpc-java=protoc-gen-grpc-java-1.66.0-linux-x86_64.exe --grpc-java_out=out --proto_path=proto test.proto
[libprotobuf ERROR google/protobuf/descriptor.cc:4199] Invalid proto descriptor for file "test.proto":
[libprotobuf ERROR google/protobuf/descriptor.cc:4202] test.proto: Unrecognized syntax: editions
--grpc-java_out: protoc-gen-grpc-java: Plugin failed with status code 1.
Is above behavior expected at this point or am I doing something wrong? I see support was added in this commit: https://github.com/grpc/grpc-java/commit/532241450 By the way, comment and preprocessor directive refer to protobuf version 5.27. Shouldn't it be 4.27?
Even if version typo is a culprit I suppose that it won't be enough because, if I understand correctly, grpc-java internally uses protobuf 21.7? buildscripts/make_dependencies.sh:6:PROTOBUF_VERSION=21.7 https://github.com/grpc/grpc-java/blob/master/buildscripts/make_dependencies.sh#L6
Describe the solution you'd like
protoc-gen-grpc-java should support edition="2023" syntax.
Describe alternatives you've considered
I can use proto3 for now.
Additional context
(none)
This is blocked on upgrading C++ protobuf. Adding the absl dependency greatly disrupted the build. https://github.com/grpc/grpc-java/pull/10048
Is there anything we can do to help in adding support for editions in grpc-java? There are huge wins for Devex in editions 2023 like the explicit presence or the enums default values that will be unblocked if we can add support.
#11961 got us from protobuf 21 to 22, which is past the absl difficulties. I'm pretty sure we'll need further CI upgrades to get to 27, but hopefully we can close the gap easily.
Is there any update or plan on this?
Hi all,
In the meantime, Protobuf announced Editions 2024 (see). @ejona86 Does it make sense to directly add support for Editions 2024?
Regards