Skip to content

Commit b69bd64

Browse files
authored
Populate the pb::java feature extension to gprc proto plugin (#11885)
Populate the pb::java feature extension to the protoc plugins that require Protobuf Java feature resolution for the edition.
1 parent fca1d3c commit b69bd64

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/src/java_plugin/cpp/java_plugin.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323

2424
#include "java_generator.h"
2525
#include <google/protobuf/compiler/code_generator.h>
26+
#if GOOGLE_PROTOBUF_VERSION >= 5027000
27+
#include <google/protobuf/compiler/java/java_features.pb.h>
28+
#endif
2629
#include <google/protobuf/compiler/plugin.h>
2730
#include <google/protobuf/descriptor.h>
2831
#include <google/protobuf/io/zero_copy_stream.h>
@@ -57,6 +60,10 @@ class JavaGrpcGenerator : public protobuf::compiler::CodeGenerator {
5760
protobuf::Edition GetMaximumEdition() const override {
5861
return protobuf::Edition::EDITION_2023;
5962
}
63+
std::vector<const protobuf::FieldDescriptor*> GetFeatureExtensions()
64+
const override {
65+
return {GetExtensionReflection(pb::java)};
66+
}
6067
#else
6168
uint64_t GetSupportedFeatures() const override {
6269
return Feature::FEATURE_PROTO3_OPTIONAL;

0 commit comments

Comments
 (0)