Skip to content

Commit 9dbc5d4

Browse files
anandoleecopybara-github
authored andcommitted
Breaking Change: Remove deprecated FieldDescriptor::is_optional() in OSS. Use (!is_required() && !is_repeated()) instead
https://protobuf.dev/news/2025-09-19/#cpp-remove-apis PiperOrigin-RevId: 843767334
1 parent cbaf01a commit 9dbc5d4

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

src/google/protobuf/descriptor.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -940,9 +940,6 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase,
940940
bool is_required() const;
941941
bool is_repeated() const; // Whether or not the field is repeated/map field.
942942

943-
ABSL_DEPRECATE_AND_INLINE()
944-
bool is_optional() const; // Use !is_required() && !is_repeated() instead.
945-
946943
bool is_packable() const; // shorthand for is_repeated() &&
947944
// IsTypePackable(type())
948945
bool is_map() const; // shorthand for type() == TYPE_MESSAGE &&
@@ -2939,10 +2936,6 @@ inline FieldDescriptor::CppStringType FieldDescriptor::cpp_string_type() const {
29392936
return static_cast<FieldDescriptor::CppStringType>(cpp_string_type_);
29402937
}
29412938

2942-
inline bool FieldDescriptor::is_optional() const {
2943-
return !is_repeated() && !is_required();
2944-
}
2945-
29462939
inline bool FieldDescriptor::is_repeated() const {
29472940
ABSL_DCHECK_EQ(is_repeated_, static_cast<Label>(label_) == LABEL_REPEATED);
29482941
return is_repeated_;

0 commit comments

Comments
 (0)