Skip to content

Commit 0a6a516

Browse files
mkruskal-googlecopybara-github
authored andcommitted
Breaking change: Remove deprecated SupportsUnknownEnumValues method
PiperOrigin-RevId: 588109737
1 parent 7c2acc9 commit 0a6a516

2 files changed

Lines changed: 0 additions & 38 deletions

File tree

src/google/protobuf/generated_message_reflection.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,11 +2655,6 @@ const FieldDescriptor* Reflection::FindKnownExtensionByNumber(
26552655
return descriptor_pool_->FindExtensionByNumber(descriptor_, number);
26562656
}
26572657

2658-
bool Reflection::SupportsUnknownEnumValues() const {
2659-
return FileDescriptorLegacy(descriptor_->file()).syntax() ==
2660-
FileDescriptorLegacy::Syntax::SYNTAX_PROTO3;
2661-
}
2662-
26632658
// ===================================================================
26642659
// Some private helpers.
26652660

src/google/protobuf/message.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -887,39 +887,6 @@ class PROTOBUF_EXPORT Reflection final {
887887
// Returns nullptr if no extension is known for this name or number.
888888
const FieldDescriptor* FindKnownExtensionByNumber(int number) const;
889889

890-
// Feature Flags -------------------------------------------------------------
891-
892-
// Does this message support storing arbitrary integer values in enum fields?
893-
// If |true|, GetEnumValue/SetEnumValue and associated repeated-field versions
894-
// take arbitrary integer values, and the legacy GetEnum() getter will
895-
// dynamically create an EnumValueDescriptor for any integer value without
896-
// one. If |false|, setting an unknown enum value via the integer-based
897-
// setters results in undefined behavior (in practice, ABSL_DCHECK-fails).
898-
//
899-
// Generic code that uses reflection to handle messages with enum fields
900-
// should check this flag before using the integer-based setter, and either
901-
// downgrade to a compatible value or use the UnknownFieldSet if not. For
902-
// example:
903-
//
904-
// int new_value = GetValueFromApplicationLogic();
905-
// if (reflection->SupportsUnknownEnumValues()) {
906-
// reflection->SetEnumValue(message, field, new_value);
907-
// } else {
908-
// if (field_descriptor->enum_type()->
909-
// FindValueByNumber(new_value) != nullptr) {
910-
// reflection->SetEnumValue(message, field, new_value);
911-
// } else if (emit_unknown_enum_values) {
912-
// reflection->MutableUnknownFields(message)->AddVarint(
913-
// field->number(), new_value);
914-
// } else {
915-
// // convert value to a compatible/default value.
916-
// new_value = CompatibleDowngrade(new_value);
917-
// reflection->SetEnumValue(message, field, new_value);
918-
// }
919-
// }
920-
ABSL_DEPRECATED("Use EnumDescriptor::is_closed instead.")
921-
bool SupportsUnknownEnumValues() const;
922-
923890
// Returns the MessageFactory associated with this message. This can be
924891
// useful for determining if a message is a generated message or not, for
925892
// example:

0 commit comments

Comments
 (0)