Skip to content

Commit 5322414

Browse files
Advertise editions support in plugin
1 parent 14fd81f commit 5322414

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

compiler/src/java_plugin/cpp/java_plugin.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,23 @@ class JavaGrpcGenerator : public protobuf::compiler::CodeGenerator {
4545
JavaGrpcGenerator() {}
4646
virtual ~JavaGrpcGenerator() {}
4747

48+
// Protobuf 5.27 released edition 2023.
49+
#if GOOGLE_PROTOBUF_VERSION >= 5027000
4850
uint64_t GetSupportedFeatures() const override {
49-
return FEATURE_PROTO3_OPTIONAL;
51+
return Feature::FEATURE_PROTO3_OPTIONAL |
52+
Feature::FEATURE_SUPPORTS_EDITIONS;
5053
}
54+
protobuf::Edition GetMinimumEdition() const override {
55+
return protobuf::Edition::EDITION_PROTO2;
56+
}
57+
protobuf::Edition GetMaximumEdition() const override {
58+
return protobuf::Edition::EDITION_2023;
59+
}
60+
#else
61+
uint64_t GetSupportedFeatures() const override {
62+
return Feature::FEATURE_PROTO3_OPTIONAL;
63+
}
64+
#endif
5165

5266
virtual bool Generate(const protobuf::FileDescriptor* file,
5367
const std::string& parameter,

0 commit comments

Comments
 (0)