mirror of
https://github.com/protocolbuffers/protobuf
synced 2026-08-26 02:23:14 -04:00
Breaking Change: Remove deprecated FieldDescriptor::has_optional_keyword() in OSS. Use is_repeated() or has_presence() instead
https://protobuf.dev/news/2025-09-19/#cpp-remove-apis PiperOrigin-RevId: 844846518
This commit is contained in:
parent
60f0834f1c
commit
68346ec934
2 changed files with 2 additions and 12 deletions
|
|
@ -3961,7 +3961,8 @@ void FieldDescriptor::DebugString(
|
|||
|
||||
// Label is omitted for maps, oneof, and plain proto3 fields.
|
||||
if (is_map() || real_containing_oneof() ||
|
||||
(!is_required() && !is_repeated() && !has_optional_keyword())) {
|
||||
(!is_required() && !is_repeated() && !proto3_optional_ &&
|
||||
file()->edition() == Edition::EDITION_PROTO3)) {
|
||||
label.clear();
|
||||
}
|
||||
// Label is omitted for optional and required fields under editions.
|
||||
|
|
@ -4283,12 +4284,6 @@ bool FieldDescriptor::legacy_enum_field_treated_as_closed() const {
|
|||
enum_type()->is_closed());
|
||||
}
|
||||
|
||||
bool FieldDescriptor::has_optional_keyword() const {
|
||||
return proto3_optional_ ||
|
||||
(file()->edition() == Edition::EDITION_PROTO2 && !is_required() &&
|
||||
!is_repeated() && !containing_oneof());
|
||||
}
|
||||
|
||||
FieldDescriptor::CppStringType FieldDescriptor::CalculateCppStringType() const {
|
||||
ABSL_DCHECK(cpp_type() == FieldDescriptor::CPPTYPE_STRING);
|
||||
|
||||
|
|
|
|||
|
|
@ -1137,11 +1137,6 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase,
|
|||
int legacy_proto_ctype() const { return legacy_proto_ctype_; }
|
||||
bool has_legacy_proto_ctype() const;
|
||||
|
||||
// Returns true if this field was syntactically written with "optional" in the
|
||||
// .proto file. Excludes singular proto3 fields that do not have a label.
|
||||
ABSL_DEPRECATED("Use has_presence() instead.")
|
||||
bool has_optional_keyword() const;
|
||||
|
||||
// Get the merged features that apply to this field. These are specified in
|
||||
// the .proto file through the feature options in the message definition.
|
||||
// Allowed features are defined by Features in descriptor.proto, along with
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue