diff --git a/src/google/protobuf/reflection.h b/src/google/protobuf/reflection.h index b493fcc738ac..9b5208c55448 100644 --- a/src/google/protobuf/reflection.h +++ b/src/google/protobuf/reflection.h @@ -13,6 +13,7 @@ #include #include +#include "absl/base/attributes.h" #include "google/protobuf/generated_enum_util.h" #include "google/protobuf/descriptor.h" @@ -96,6 +97,8 @@ class MutableRepeatedFieldRef< } void Add(const T& value) const { accessor_->template Add(data_, value); } void RemoveLast() const { accessor_->RemoveLast(data_); } + // TODO: Remove. + ABSL_DEPRECATED("Do not use. Will be removed in a future release.") void Reserve(int size) const { accessor_->Reserve(data_, size); } void SwapElements(int index1, int index2) const { accessor_->SwapElements(data_, index1, index2); @@ -215,6 +218,8 @@ class MutableRepeatedFieldRef< } void Add(const T& value) const { accessor_->Add(data_, &value); } void RemoveLast() const { accessor_->RemoveLast(data_); } + // TODO: Remove. + ABSL_DEPRECATED("Do not use. Will be removed in a future release.") void Reserve(int size) const { accessor_->Reserve(data_, size); } void SwapElements(int index1, int index2) const { accessor_->SwapElements(data_, index1, index2); @@ -303,6 +308,8 @@ class PROTOBUF_EXPORT RepeatedFieldAccessor { virtual void Set(Field* data, int index, const Value* value) const = 0; virtual void Add(Field* data, const Value* value) const = 0; virtual void RemoveLast(Field* data) const = 0; + // TODO: Remove. + ABSL_DEPRECATED("Do not use. Will be removed in a future release.") virtual void Reserve(Field* data, int size) const = 0; virtual void SwapElements(Field* data, int index1, int index2) const = 0; virtual void Swap(Field* data, const RepeatedFieldAccessor* other_mutator, diff --git a/src/google/protobuf/reflection_internal.h b/src/google/protobuf/reflection_internal.h index ea4bac293a18..6d8008801977 100644 --- a/src/google/protobuf/reflection_internal.h +++ b/src/google/protobuf/reflection_internal.h @@ -87,6 +87,7 @@ class RepeatedFieldWrapper : public RandomAccessRepeatedFieldAccessor { void RemoveLast(Field* data) const override { MutableRepeatedField(data)->RemoveLast(); } + // TODO: Remove. void Reserve(Field* data, int size) const override { MutableRepeatedField(data)->Reserve(size); } @@ -146,6 +147,7 @@ class RepeatedPtrFieldWrapper : public RandomAccessRepeatedFieldAccessor { void RemoveLast(Field* data) const override { MutableRepeatedField(data)->RemoveLast(); } + // TODO: Remove. void Reserve(Field* data, int size) const override { MutableRepeatedField(data)->Reserve(size); }