From 0c6e090b3543a1da9b88dd5e2a8ebcdceaa01135 Mon Sep 17 00:00:00 2001 From: ZHANG Dapeng Date: Thu, 21 May 2020 15:39:10 -0700 Subject: [PATCH] compiler: support proto3 field presence for codegen Support proto3 field presence #7051. This is the same change as https://github.com/grpc/grpc/pull/22998/files#diff-6c29ff8771ae54ddf2c14e2ef3eb554fR37-R44 --- compiler/src/java_plugin/cpp/java_plugin.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/src/java_plugin/cpp/java_plugin.cpp b/compiler/src/java_plugin/cpp/java_plugin.cpp index a62fb8677d6..d8b10c52422 100644 --- a/compiler/src/java_plugin/cpp/java_plugin.cpp +++ b/compiler/src/java_plugin/cpp/java_plugin.cpp @@ -43,10 +43,14 @@ class JavaGrpcGenerator : public google::protobuf::compiler::CodeGenerator { JavaGrpcGenerator() {} virtual ~JavaGrpcGenerator() {} + uint64_t GetSupportedFeatures() const override { + return FEATURE_PROTO3_OPTIONAL; + } + virtual bool Generate(const google::protobuf::FileDescriptor* file, const std::string& parameter, google::protobuf::compiler::GeneratorContext* context, - std::string* error) const { + std::string* error) const override { std::vector > options; google::protobuf::compiler::ParseGeneratorParameter(parameter, &options);