Temporarily turn off extension support for weak descriptor messages.

As it is currently implemented it leads to descriptors being parsed before
extensions are registered, causing the descriptors to have unknown fields for
custom descriptor options.

PiperOrigin-RevId: 597645764
pull/15403/head
Protobuf Team Bot 11 months ago committed by Copybara-Service
parent 5df0387224
commit 8812654500
  1. 5
      src/google/protobuf/compiler/cpp/extension.cc

@ -205,7 +205,10 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p) {
{"lazy", descriptor_->options().has_lazy()
? descriptor_->options().lazy() ? "kLazy" : "kEager"
: "kUndefined"}});
if (UsingImplicitWeakDescriptor(descriptor_->file(), options_)) {
// Temporarily disable weak descriptor message for extensions.
// It is currently incorrect for custom descriptor options. We end up
// parsing the descriptors before the custom options are registered.
if (false && UsingImplicitWeakDescriptor(descriptor_->file(), options_)) {
const auto find_index = [](auto* desc) {
const std::vector<const Descriptor*> msgs =
FlattenMessagesInFile(desc->file());

Loading…
Cancel
Save