|
|
|
@ -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; |
|
|
|
|