Add extension declarations for known features.

This will prevent users from accidentally overriding these with different types (e.g. https://github.com/protocolbuffers/protobuf/issues/16757 and https://github.com/protocolbuffers/protobuf/issues/16756).

PiperOrigin-RevId: 633760581
pull/16774/head
Mike Kruskal 7 months ago committed by Copybara-Service
parent df630fa6f1
commit 6b9a81a042
  1. 74
      src/google/protobuf/descriptor.pb.cc
  2. 23
      src/google/protobuf/descriptor.proto

@ -1897,7 +1897,7 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] AB
"ive_int_value\030\005 \001(\003\022\024\n\014double_value\030\006 \001("
"\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017aggregate_val"
"ue\030\010 \001(\t\0323\n\010NamePart\022\021\n\tname_part\030\001 \002(\t\022"
"\024\n\014is_extension\030\002 \002(\010\"\333\t\n\nFeatureSet\022\202\001\n"
"\024\n\014is_extension\030\002 \002(\010\"\303\t\n\nFeatureSet\022\202\001\n"
"\016field_presence\030\001 \001(\0162).google.protobuf."
"FeatureSet.FieldPresenceB\?\210\001\001\230\001\004\230\001\001\242\001\r\022\010"
"EXPLICIT\030\346\007\242\001\r\022\010IMPLICIT\030\347\007\242\001\r\022\010EXPLICIT"
@ -1927,47 +1927,47 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] AB
"GE_ENCODING_UNKNOWN\020\000\022\023\n\017LENGTH_PREFIXED"
"\020\001\022\r\n\tDELIMITED\020\002\"H\n\nJsonFormat\022\027\n\023JSON_"
"FORMAT_UNKNOWN\020\000\022\t\n\005ALLOW\020\001\022\026\n\022LEGACY_BE"
"ST_EFFORT\020\002*\006\010\350\007\020\351\007*\006\010\351\007\020\352\007*\006\010\352\007\020\353\007*\006\010\206N"
"\020\207N*\006\010\213N\020\220N*\006\010\220N\020\221NJ\006\010\347\007\020\350\007\"\202\003\n\022FeatureS"
"etDefaults\022N\n\010defaults\030\001 \003(\0132<.google.pr"
"otobuf.FeatureSetDefaults.FeatureSetEdit"
"ionDefault\0221\n\017minimum_edition\030\004 \001(\0162\030.go"
"ogle.protobuf.Edition\0221\n\017maximum_edition"
"\030\005 \001(\0162\030.google.protobuf.Edition\032\265\001\n\030Fea"
"tureSetEditionDefault\022)\n\007edition\030\003 \001(\0162\030"
".google.protobuf.Edition\0229\n\024overridable_"
"features\030\004 \001(\0132\033.google.protobuf.Feature"
"Set\0223\n\016fixed_features\030\005 \001(\0132\033.google.pro"
"tobuf.FeatureSet\"\325\001\n\016SourceCodeInfo\022:\n\010l"
"ocation\030\001 \003(\0132(.google.protobuf.SourceCo"
"deInfo.Location\032\206\001\n\010Location\022\020\n\004path\030\001 \003"
"(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020leading_comm"
"ents\030\003 \001(\t\022\031\n\021trailing_comments\030\004 \001(\t\022!\n"
"\031leading_detached_comments\030\006 \003(\t\"\234\002\n\021Gen"
"eratedCodeInfo\022A\n\nannotation\030\001 \003(\0132-.goo"
"gle.protobuf.GeneratedCodeInfo.Annotatio"
"n\032\303\001\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013so"
"urce_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 "
"\001(\005\022H\n\010semantic\030\005 \001(\01626.google.protobuf."
"GeneratedCodeInfo.Annotation.Semantic\"(\n"
"\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALIAS\020\002*"
"\247\002\n\007Edition\022\023\n\017EDITION_UNKNOWN\020\000\022\023\n\016EDIT"
"ION_LEGACY\020\204\007\022\023\n\016EDITION_PROTO2\020\346\007\022\023\n\016ED"
"ITION_PROTO3\020\347\007\022\021\n\014EDITION_2023\020\350\007\022\021\n\014ED"
"ITION_2024\020\351\007\022\027\n\023EDITION_1_TEST_ONLY\020\001\022\027"
"\n\023EDITION_2_TEST_ONLY\020\002\022\035\n\027EDITION_99997"
"_TEST_ONLY\020\235\215\006\022\035\n\027EDITION_99998_TEST_ONL"
"Y\020\236\215\006\022\035\n\027EDITION_99999_TEST_ONLY\020\237\215\006\022\023\n\013"
"EDITION_MAX\020\377\377\377\377\007B~\n\023com.google.protobuf"
"B\020DescriptorProtosH\001Z-google.golang.org/"
"protobuf/types/descriptorpb\370\001\001\242\002\003GPB\252\002\032G"
"oogle.Protobuf.Reflection"
"ST_EFFORT\020\002*\006\010\350\007\020\213N*\006\010\213N\020\220N*\006\010\220N\020\221NJ\006\010\347\007"
"\020\350\007\"\202\003\n\022FeatureSetDefaults\022N\n\010defaults\030\001"
" \003(\0132<.google.protobuf.FeatureSetDefault"
"s.FeatureSetEditionDefault\0221\n\017minimum_ed"
"ition\030\004 \001(\0162\030.google.protobuf.Edition\0221\n"
"\017maximum_edition\030\005 \001(\0162\030.google.protobuf"
".Edition\032\265\001\n\030FeatureSetEditionDefault\022)\n"
"\007edition\030\003 \001(\0162\030.google.protobuf.Edition"
"\0229\n\024overridable_features\030\004 \001(\0132\033.google."
"protobuf.FeatureSet\0223\n\016fixed_features\030\005 "
"\001(\0132\033.google.protobuf.FeatureSet\"\325\001\n\016Sou"
"rceCodeInfo\022:\n\010location\030\001 \003(\0132(.google.p"
"rotobuf.SourceCodeInfo.Location\032\206\001\n\010Loca"
"tion\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001"
"\022\030\n\020leading_comments\030\003 \001(\t\022\031\n\021trailing_c"
"omments\030\004 \001(\t\022!\n\031leading_detached_commen"
"ts\030\006 \003(\t\"\234\002\n\021GeneratedCodeInfo\022A\n\nannota"
"tion\030\001 \003(\0132-.google.protobuf.GeneratedCo"
"deInfo.Annotation\032\303\001\n\nAnnotation\022\020\n\004path"
"\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 \001(\t\022\r\n\005begin"
"\030\003 \001(\005\022\013\n\003end\030\004 \001(\005\022H\n\010semantic\030\005 \001(\01626."
"google.protobuf.GeneratedCodeInfo.Annota"
"tion.Semantic\"(\n\010Semantic\022\010\n\004NONE\020\000\022\007\n\003S"
"ET\020\001\022\t\n\005ALIAS\020\002*\247\002\n\007Edition\022\023\n\017EDITION_U"
"NKNOWN\020\000\022\023\n\016EDITION_LEGACY\020\204\007\022\023\n\016EDITION"
"_PROTO2\020\346\007\022\023\n\016EDITION_PROTO3\020\347\007\022\021\n\014EDITI"
"ON_2023\020\350\007\022\021\n\014EDITION_2024\020\351\007\022\027\n\023EDITION"
"_1_TEST_ONLY\020\001\022\027\n\023EDITION_2_TEST_ONLY\020\002\022"
"\035\n\027EDITION_99997_TEST_ONLY\020\235\215\006\022\035\n\027EDITIO"
"N_99998_TEST_ONLY\020\236\215\006\022\035\n\027EDITION_99999_T"
"EST_ONLY\020\237\215\006\022\023\n\013EDITION_MAX\020\377\377\377\377\007B~\n\023com"
".google.protobufB\020DescriptorProtosH\001Z-go"
"ogle.golang.org/protobuf/types/descripto"
"rpb\370\001\001\242\002\003GPB\252\002\032Google.Protobuf.Reflectio"
"n"
};
static ::absl::once_flag descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once;
PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto = {
false,
false,
9985,
9961,
descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto,
"google/protobuf/descriptor.proto",
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,

@ -1066,11 +1066,24 @@ message FeatureSet {
reserved 999;
extensions 1000; // for Protobuf C++
extensions 1001; // for Protobuf Java
extensions 1002; // for Protobuf Go
extensions 9990; // for deprecated Java Proto1
extensions 1000 to 9994 [
declaration = {
number: 1000,
full_name: ".pb.cpp",
type: ".pb.CppFeatures"
},
declaration = {
number: 1001,
full_name: ".pb.java",
type: ".pb.JavaFeatures"
},
declaration = { number: 1002, full_name: ".pb.go", type: ".pb.GoFeatures" },
declaration = {
number: 9990,
full_name: ".pb.proto1",
type: ".pb.Proto1Features"
}
];
extensions 9995 to 9999; // For internal testing
extensions 10000; // for https://github.com/bufbuild/protobuf-es

Loading…
Cancel
Save