Internal changes

PiperOrigin-RevId: 494184752
pull/11189/head
Mike Kruskal 2 years ago committed by Copybara-Service
parent fb8862f781
commit cdc56ab1b7
  1. 8
      src/google/protobuf/compiler/java/context.cc
  2. 9
      src/google/protobuf/compiler/java/enum_field.cc
  3. 6
      src/google/protobuf/compiler/java/enum_field_lite.cc
  4. 4
      src/google/protobuf/compiler/java/field.cc
  5. 4
      src/google/protobuf/compiler/java/field.h
  6. 13
      src/google/protobuf/compiler/java/file.cc
  7. 26
      src/google/protobuf/compiler/java/helpers.cc
  8. 8
      src/google/protobuf/compiler/java/map_field.cc
  9. 8
      src/google/protobuf/compiler/java/map_field_lite.cc
  10. 6
      src/google/protobuf/compiler/java/message.cc
  11. 6
      src/google/protobuf/compiler/java/message_builder.cc
  12. 4
      src/google/protobuf/compiler/java/message_builder_lite.cc
  13. 1
      src/google/protobuf/compiler/java/message_field.cc
  14. 4
      src/google/protobuf/compiler/java/message_lite.cc
  15. 6
      src/google/protobuf/compiler/java/message_serialization_unittest.cc
  16. 3
      src/google/protobuf/compiler/java/name_resolver.cc
  17. 1
      src/google/protobuf/compiler/java/name_resolver.h
  18. 5
      src/google/protobuf/compiler/java/plugin_unittest.cc
  19. 9
      src/google/protobuf/compiler/java/primitive_field.cc
  20. 4
      src/google/protobuf/compiler/java/primitive_field_lite.cc
  21. 1
      src/google/protobuf/compiler/java/service.cc
  22. 6
      src/google/protobuf/compiler/java/string_field.cc
  23. 6
      src/google/protobuf/compiler/java/string_field_lite.cc

@ -30,6 +30,7 @@
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/field.h"
#include "google/protobuf/compiler/java/helpers.h"
@ -146,7 +147,8 @@ void Context::InitializeFieldGeneratorInfoForFields(
}
}
if (is_conflict[i]) {
GOOGLE_LOG(WARNING) << "field \"" << field->full_name() << "\" is conflicting "
GOOGLE_ABSL_LOG(WARNING) << "field \"" << field->full_name()
<< "\" is conflicting "
<< "with another field: " << conflict_reason[i];
}
}
@ -170,7 +172,7 @@ const FieldGeneratorInfo* Context::GetFieldGeneratorInfo(
const FieldDescriptor* field) const {
auto it = field_generator_info_map_.find(field);
if (it == field_generator_info_map_.end()) {
GOOGLE_LOG(FATAL) << "Can not find FieldGeneratorInfo for field: "
GOOGLE_ABSL_LOG(FATAL) << "Can not find FieldGeneratorInfo for field: "
<< field->full_name();
}
return &it->second;
@ -180,7 +182,7 @@ const OneofGeneratorInfo* Context::GetOneofGeneratorInfo(
const OneofDescriptor* oneof) const {
auto it = oneof_generator_info_map_.find(oneof);
if (it == oneof_generator_info_map_.end()) {
GOOGLE_LOG(FATAL) << "Can not find OneofGeneratorInfo for oneof: "
GOOGLE_ABSL_LOG(FATAL) << "Can not find OneofGeneratorInfo for oneof: "
<< oneof->name();
}
return &it->second;

@ -37,8 +37,9 @@
#include <cstdint>
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"
@ -344,7 +345,7 @@ void ImmutableEnumFieldGenerator::GenerateMergingCode(
" set$capitalized_name$Value(other.get$capitalized_name$Value());\n"
"}\n");
} else {
GOOGLE_LOG(FATAL) << "Can't reach here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't reach here.";
}
}
@ -428,7 +429,7 @@ ImmutableEnumOneofFieldGenerator::~ImmutableEnumOneofFieldGenerator() {}
void ImmutableEnumOneofFieldGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
@ -463,7 +464,7 @@ void ImmutableEnumOneofFieldGenerator::GenerateMembers(
void ImmutableEnumOneofFieldGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"

@ -37,8 +37,8 @@
#include <cstdint>
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h"
#include "google/protobuf/compiler/java/context.h"
@ -400,7 +400,7 @@ ImmutableEnumOneofFieldLiteGenerator::~ImmutableEnumOneofFieldLiteGenerator() {}
void ImmutableEnumOneofFieldLiteGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"
@ -476,7 +476,7 @@ void ImmutableEnumOneofFieldLiteGenerator::GenerateFieldInfo(
void ImmutableEnumOneofFieldLiteGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"

@ -37,8 +37,8 @@
#include <memory>
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/substitute.h"
#include "google/protobuf/compiler/java/context.h"
@ -186,7 +186,7 @@ static inline void ReportUnexpectedPackedFieldsCall(io::Printer* printer) {
// but this method should be overridden.
// - This FieldGenerator doesn't support packing, and this method
// should never have been called.
GOOGLE_LOG(FATAL) << "GenerateBuilderParsingCodeFromPacked() "
GOOGLE_ABSL_LOG(FATAL) << "GenerateBuilderParsingCodeFromPacked() "
<< "called on field generator that does not support packing.";
}

@ -39,8 +39,8 @@
#include <memory>
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/port.h"
@ -135,7 +135,7 @@ class FieldGeneratorMap {
template <typename FieldGeneratorType>
inline const FieldGeneratorType& FieldGeneratorMap<FieldGeneratorType>::get(
const FieldDescriptor* field) const {
GOOGLE_CHECK_EQ(field->containing_type(), descriptor_);
GOOGLE_ABSL_CHECK_EQ(field->containing_type(), descriptor_);
return *field_generators_[field->index()];
}

@ -38,6 +38,7 @@
#include <vector>
#include "absl/container/btree_set.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/compiler/java/context.h"
@ -132,7 +133,7 @@ void CollectExtensions(const FileDescriptorProto& file_proto,
// builder-pool to find out all extensions.
const Descriptor* file_proto_desc = alternate_pool.FindMessageTypeByName(
file_proto.GetDescriptor()->full_name());
GOOGLE_CHECK(file_proto_desc)
GOOGLE_ABSL_CHECK(file_proto_desc)
<< "Find unknown fields in FileDescriptorProto when building "
<< file_proto.name()
<< ". It's likely that those fields are custom options, however, "
@ -141,14 +142,14 @@ void CollectExtensions(const FileDescriptorProto& file_proto,
DynamicMessageFactory factory;
std::unique_ptr<Message> dynamic_file_proto(
factory.GetPrototype(file_proto_desc)->New());
GOOGLE_CHECK(dynamic_file_proto.get() != NULL);
GOOGLE_CHECK(dynamic_file_proto->ParseFromString(file_data));
GOOGLE_ABSL_CHECK(dynamic_file_proto.get() != NULL);
GOOGLE_ABSL_CHECK(dynamic_file_proto->ParseFromString(file_data));
// Collect the extensions again from the dynamic message. There should be no
// more unknown fields this time, i.e. all the custom options should be
// parsed as extensions now.
extensions->clear();
GOOGLE_CHECK(CollectExtensions(*dynamic_file_proto, extensions))
GOOGLE_ABSL_CHECK(CollectExtensions(*dynamic_file_proto, extensions))
<< "Find unknown fields in FileDescriptorProto when building "
<< file_proto.name()
<< ". It's likely that those fields are custom options, however, "
@ -233,7 +234,7 @@ bool FileGenerator::Validate(std::string* error) {
// because filenames are case-insensitive on those platforms.
if (name_resolver_->HasConflictingClassName(
file_, classname_, NameEquality::EQUAL_IGNORE_CASE)) {
GOOGLE_LOG(WARNING)
GOOGLE_ABSL_LOG(WARNING)
<< file_->name() << ": The file's outer class name, \"" << classname_
<< "\", matches the name of one of the types declared inside it when "
<< "case is ignored. This can cause compilation issues on Windows / "
@ -245,7 +246,7 @@ bool FileGenerator::Validate(std::string* error) {
// Print a warning if optimize_for = LITE_RUNTIME is used.
if (file_->options().optimize_for() == FileOptions::LITE_RUNTIME &&
!options_.enforce_lite) {
GOOGLE_LOG(WARNING)
GOOGLE_ABSL_LOG(WARNING)
<< "The optimize_for = LITE_RUNTIME option is no longer supported by "
<< "protobuf Java code generator and is ignored--protoc will always "
<< "generate full runtime code for Java. To use Java Lite runtime, "

@ -40,6 +40,8 @@
#include <vector>
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
@ -106,7 +108,7 @@ void PrintEnumVerifierLogic(
std::string UnderscoresToCamelCase(const std::string& input,
bool cap_next_letter) {
GOOGLE_CHECK(!input.empty());
GOOGLE_ABSL_CHECK(!input.empty());
std::string result;
// Note: I distrust ctype.h due to locales.
for (int i = 0; i < input.size(); i++) {
@ -287,7 +289,7 @@ JavaType GetJavaType(const FieldDescriptor* field) {
// types are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return JAVATYPE_INT;
}
@ -316,7 +318,7 @@ const char* PrimitiveTypeName(JavaType type) {
// JavaTypes are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return NULL;
}
@ -349,7 +351,7 @@ const char* BoxedPrimitiveTypeName(JavaType type) {
// JavaTypes are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return NULL;
}
@ -382,7 +384,7 @@ const char* KotlinTypeName(JavaType type) {
// JavaTypes are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return NULL;
}
@ -441,7 +443,7 @@ const char* FieldTypeName(FieldDescriptor::Type field_type) {
// types are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return NULL;
}
@ -529,7 +531,7 @@ std::string DefaultValue(const FieldDescriptor* field, bool immutable,
// types are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return "";
}
@ -561,7 +563,7 @@ bool IsDefaultValueJavaDefault(const FieldDescriptor* field) {
// types are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return false;
}
@ -675,7 +677,7 @@ bool IsReferenceType(JavaType type) {
// JavaTypes are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return false;
}
@ -724,7 +726,7 @@ const char* GetCapitalizedType(const FieldDescriptor* field, bool immutable,
// types are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return NULL;
}
@ -774,7 +776,7 @@ int FixedSize(FieldDescriptor::Type type) {
// No default because we want the compiler to complain if any new
// types are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return -1;
}
@ -910,7 +912,7 @@ int GetExperimentalJavaFieldTypeForPacked(const FieldDescriptor* field) {
} else if (result > FieldDescriptor::TYPE_BYTES) {
return result + 30;
} else {
GOOGLE_LOG(FATAL) << field->full_name() << " can't be packed.";
GOOGLE_ABSL_LOG(FATAL) << field->full_name() << " can't be packed.";
return 0;
}
}

@ -48,16 +48,16 @@ namespace java {
namespace {
const FieldDescriptor* KeyField(const FieldDescriptor* descriptor) {
GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
const Descriptor* message = descriptor->message_type();
GOOGLE_CHECK(message->options().map_entry());
GOOGLE_ABSL_CHECK(message->options().map_entry());
return message->map_key();
}
const FieldDescriptor* ValueField(const FieldDescriptor* descriptor) {
GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
const Descriptor* message = descriptor->message_type();
GOOGLE_CHECK(message->options().map_entry());
GOOGLE_ABSL_CHECK(message->options().map_entry());
return message->map_value();
}

@ -49,16 +49,16 @@ namespace java {
namespace {
const FieldDescriptor* KeyField(const FieldDescriptor* descriptor) {
GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
const Descriptor* message = descriptor->message_type();
GOOGLE_CHECK(message->options().map_entry());
GOOGLE_ABSL_CHECK(message->options().map_entry());
return message->map_key();
}
const FieldDescriptor* ValueField(const FieldDescriptor* descriptor) {
GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
const Descriptor* message = descriptor->message_type();
GOOGLE_CHECK(message->options().map_entry());
GOOGLE_ABSL_CHECK(message->options().map_entry());
return message->map_value();
}

@ -73,7 +73,7 @@ namespace {
std::string MapValueImmutableClassdName(const Descriptor* descriptor,
ClassNameResolver* name_resolver) {
const FieldDescriptor* value_field = descriptor->map_value();
GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, value_field->type());
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, value_field->type());
return name_resolver->GetImmutableClassName(value_field->message_type());
}
} // namespace
@ -85,7 +85,7 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor)
for (int i = 0; i < descriptor_->field_count(); i++) {
if (IsRealOneof(descriptor_->field(i))) {
const OneofDescriptor* oneof = descriptor_->field(i)->containing_oneof();
GOOGLE_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
GOOGLE_ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
}
}
}
@ -99,7 +99,7 @@ ImmutableMessageGenerator::ImmutableMessageGenerator(
context_(context),
name_resolver_(context->GetNameResolver()),
field_generators_(descriptor, context_) {
GOOGLE_CHECK(HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
GOOGLE_ABSL_CHECK(HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
<< "Generator factory error: A non-lite message generator is used to "
"generate lite messages.";
}

@ -70,7 +70,7 @@ namespace {
std::string MapValueImmutableClassdName(const Descriptor* descriptor,
ClassNameResolver* name_resolver) {
const FieldDescriptor* value_field = descriptor->map_value();
GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, value_field->type());
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, value_field->type());
return name_resolver->GetImmutableClassName(value_field->message_type());
}
} // namespace
@ -81,13 +81,13 @@ MessageBuilderGenerator::MessageBuilderGenerator(const Descriptor* descriptor,
context_(context),
name_resolver_(context->GetNameResolver()),
field_generators_(descriptor, context_) {
GOOGLE_CHECK(HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
GOOGLE_ABSL_CHECK(HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
<< "Generator factory error: A non-lite message generator is used to "
"generate lite messages.";
for (int i = 0; i < descriptor_->field_count(); i++) {
if (IsRealOneof(descriptor_->field(i))) {
const OneofDescriptor* oneof = descriptor_->field(i)->containing_oneof();
GOOGLE_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
GOOGLE_ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
}
}
}

@ -68,13 +68,13 @@ MessageBuilderLiteGenerator::MessageBuilderLiteGenerator(
context_(context),
name_resolver_(context->GetNameResolver()),
field_generators_(descriptor, context_) {
GOOGLE_CHECK(!HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
GOOGLE_ABSL_CHECK(!HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
<< "Generator factory error: A lite message generator is used to "
"generate non-lite messages.";
for (int i = 0; i < descriptor_->field_count(); i++) {
if (IsRealOneof(descriptor_->field(i))) {
const OneofDescriptor* oneof = descriptor_->field(i)->containing_oneof();
GOOGLE_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
GOOGLE_ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
}
}
}

@ -36,6 +36,7 @@
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"

@ -76,13 +76,13 @@ ImmutableMessageLiteGenerator::ImmutableMessageLiteGenerator(
context_(context),
name_resolver_(context->GetNameResolver()),
field_generators_(descriptor, context_) {
GOOGLE_CHECK(!HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
GOOGLE_ABSL_CHECK(!HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
<< "Generator factory error: A lite message generator is used to "
"generate non-lite messages.";
for (int i = 0; i < descriptor_->field_count(); i++) {
if (IsRealOneof(descriptor_->field(i))) {
const OneofDescriptor* oneof = descriptor_->field(i)->containing_oneof();
GOOGLE_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
GOOGLE_ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
}
}
}

@ -33,12 +33,12 @@
#include <utility>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/testing/file.h"
#include "google/protobuf/testing/file.h"
#include <gmock/gmock.h>
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h"
#include "google/protobuf/compiler/command_line_interface.h"
@ -77,10 +77,10 @@ int CompileJavaProto(std::string proto_file_name) {
}
TEST(MessageSerializationTest, CollapseAdjacentExtensionRanges) {
GOOGLE_CHECK_EQ(CompileJavaProto("message_serialization_unittest.proto"), 0);
GOOGLE_ABSL_CHECK_EQ(CompileJavaProto("message_serialization_unittest.proto"), 0);
std::string java_source;
GOOGLE_CHECK_OK(File::GetContents(
GOOGLE_ABSL_CHECK_OK(File::GetContents(
// Open-source codebase does not support file::JoinPath, so we manually
// concatenate instead.
absl::StrCat(TestTempDir(),

@ -32,6 +32,7 @@
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/ascii.h"
#include "absl/strings/str_replace.h"
#include "absl/strings/substitute.h"
@ -104,7 +105,7 @@ std::string ClassNameWithoutPackage(const ServiceDescriptor* descriptor,
std::string full_name =
StripPackageName(descriptor->full_name(), descriptor->file());
// We don't allow nested service definitions.
GOOGLE_CHECK(full_name.find('.') == std::string::npos);
GOOGLE_ABSL_CHECK(full_name.find('.') == std::string::npos);
return full_name;
}

@ -33,7 +33,6 @@
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/compiler/java/options.h"
#include "google/protobuf/port.h"

@ -37,6 +37,7 @@
#include "google/protobuf/testing/file.h"
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_split.h"
#include "google/protobuf/compiler/command_line_interface.h"
#include "google/protobuf/compiler/java/generator.h"
@ -80,7 +81,7 @@ class TestGenerator : public CodeGenerator {
// not verify that they are correctly-placed; that would require actually
// compiling the output which is a bit more than I care to do for this test.
TEST(JavaPluginTest, PluginTest) {
GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/test.proto",
GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + "/test.proto",
"syntax = \"proto2\";\n"
"package foo;\n"
"option java_package = \"\";\n"
@ -112,7 +113,7 @@ TEST(JavaPluginTest, PluginTest) {
// expect
std::string output;
GOOGLE_CHECK_OK(File::GetContents(TestTempDir() + "/Test.java", &output,
GOOGLE_ABSL_CHECK_OK(File::GetContents(TestTempDir() + "/Test.java", &output,
true));
std::vector<std::string> lines = absl::StrSplit(output, "\n");
bool found_generated_annotation = false;

@ -37,6 +37,7 @@
#include <cstdint>
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
@ -448,7 +449,7 @@ void ImmutablePrimitiveFieldGenerator::GenerateEqualsCode(
case JAVATYPE_ENUM:
case JAVATYPE_MESSAGE:
default:
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
break;
}
}
@ -499,7 +500,7 @@ void ImmutablePrimitiveFieldGenerator::GenerateHashCode(
case JAVATYPE_ENUM:
case JAVATYPE_MESSAGE:
default:
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
break;
}
}
@ -526,7 +527,7 @@ ImmutablePrimitiveOneofFieldGenerator::
void ImmutablePrimitiveOneofFieldGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"
@ -549,7 +550,7 @@ void ImmutablePrimitiveOneofFieldGenerator::GenerateMembers(
void ImmutablePrimitiveOneofFieldGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"

@ -416,7 +416,7 @@ ImmutablePrimitiveOneofFieldLiteGenerator::
void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"
@ -464,7 +464,7 @@ void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateFieldInfo(
void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"

@ -34,6 +34,7 @@
#include "google/protobuf/compiler/java/service.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"

@ -38,8 +38,8 @@
#include <cstdint>
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"
@ -521,7 +521,7 @@ ImmutableStringOneofFieldGenerator::~ImmutableStringOneofFieldGenerator() {}
void ImmutableStringOneofFieldGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
@ -585,7 +585,7 @@ void ImmutableStringOneofFieldGenerator::GenerateMembers(
void ImmutableStringOneofFieldGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"

@ -38,8 +38,8 @@
#include <cstdint>
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"
@ -408,7 +408,7 @@ ImmutableStringOneofFieldLiteGenerator::
void ImmutableStringOneofFieldLiteGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"
@ -486,7 +486,7 @@ void ImmutableStringOneofFieldLiteGenerator::GenerateFieldInfo(
void ImmutableStringOneofFieldLiteGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_DCHECK(HasHazzer(descriptor_));
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"

Loading…
Cancel
Save