internal change

PiperOrigin-RevId: 630273635
pull/16697/head
Protobuf Team Bot 9 months ago committed by Copybara-Service
parent 4f12891b87
commit d9ff109888
  1. 2
      src/google/protobuf/compiler/java/immutable/BUILD.bazel
  2. 10
      src/google/protobuf/compiler/java/immutable/enum.cc
  3. 1
      src/google/protobuf/compiler/java/immutable/enum.h
  4. 1
      src/google/protobuf/compiler/java/internal_helpers.h

@ -85,9 +85,11 @@ cc_library(
"//src/google/protobuf:port",
"//src/google/protobuf/compiler/java:generator_common",
"//src/google/protobuf/compiler/java:helpers",
"//src/google/protobuf/compiler/java:internal_helpers",
"//src/google/protobuf/io:printer",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
],
)

@ -11,13 +11,20 @@
#include "google/protobuf/compiler/java/immutable/enum.h"
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"
#include "google/protobuf/compiler/java/helpers.h"
#include "google/protobuf/compiler/java/internal_helpers.h"
#include "google/protobuf/compiler/java/name_resolver.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/io/printer.h"
@ -30,6 +37,7 @@ namespace protobuf {
namespace compiler {
namespace java {
EnumNonLiteGenerator::EnumNonLiteGenerator(const EnumDescriptor* descriptor,
bool immutable_api, Context* context)
: descriptor_(descriptor),
@ -56,6 +64,7 @@ void EnumNonLiteGenerator::Generate(io::Printer* printer) {
WriteEnumDocComment(printer, descriptor_, context_->options());
MaybePrintGeneratedAnnotation(context_, printer, descriptor_, immutable_api_);
if (!context_->options().opensource_runtime) {
printer->Print("@com.google.protobuf.Internal.ProtoNonnullApi\n");
}
@ -374,6 +383,7 @@ void EnumNonLiteGenerator::Generate(io::Printer* printer) {
printer->Print("}\n\n");
}
bool EnumNonLiteGenerator::CanUseEnumValues() {
if (canonical_values_.size() != descriptor_->value_count()) {
return false;

@ -71,6 +71,7 @@ class EnumNonLiteGenerator : public EnumGenerator {
ClassNameResolver* name_resolver_;
bool CanUseEnumValues();
};
} // namespace java

@ -50,6 +50,7 @@ inline bool CheckUtf8(const FieldDescriptor* descriptor) {
descriptor->file()->options().java_string_check_utf8();
}
// Only the lowest two bytes of the return value are used. The lowest byte
// is the integer value of a j/c/g/protobuf/FieldType enum. For the other
// byte:

Loading…
Cancel
Save