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