Skip to content

Commit 97112b2

Browse files
authored
compiler: support proto3 field presence for codegen
Support proto3 field presence grpc#7051. This is the same change as https://github.com/grpc/grpc/pull/22998/files#diff-6c29ff8771ae54ddf2c14e2ef3eb554fR37-R44
1 parent 3601190 commit 97112b2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/src/java_plugin/cpp/java_plugin.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,14 @@ class JavaGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
4343
JavaGrpcGenerator() {}
4444
virtual ~JavaGrpcGenerator() {}
4545

46+
uint64_t GetSupportedFeatures() const override {
47+
return FEATURE_PROTO3_OPTIONAL;
48+
}
49+
4650
virtual bool Generate(const google::protobuf::FileDescriptor* file,
4751
const std::string& parameter,
4852
google::protobuf::compiler::GeneratorContext* context,
49-
std::string* error) const {
53+
std::string* error) const override {
5054
std::vector<std::pair<std::string, std::string> > options;
5155
google::protobuf::compiler::ParseGeneratorParameter(parameter, &options);
5256

0 commit comments

Comments
 (0)