From 3414dc151eb4dcbdb2ca952e2589993bf7af75c4 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Mon, 6 Oct 2025 09:50:17 -0700 Subject: [PATCH] [ObjC] Remove `-[GPBFieldDescriptor optional]` As announced: https://protobuf.dev/news/2025-09-19/#objc-remove-apis Removing the deprecated api as part of the ObjC Major Version bump coming in 2026Q1. PiperOrigin-RevId: 815768697 --- objectivec/GPBDescriptor.h | 3 --- objectivec/GPBDescriptor.m | 7 ------- 2 files changed, 10 deletions(-) diff --git a/objectivec/GPBDescriptor.h b/objectivec/GPBDescriptor.h index 1ff710bf2c..a400fbbc5e 100644 --- a/objectivec/GPBDescriptor.h +++ b/objectivec/GPBDescriptor.h @@ -172,9 +172,6 @@ __attribute__((objc_subclassing_restricted)) @property(nonatomic, readonly) GPBGenericValue defaultValue; /** Whether this field is required. Only valid for proto2 fields. */ @property(nonatomic, readonly, getter=isRequired) BOOL required; -/** Whether this field is optional. */ -@property(nonatomic, readonly, getter=isOptional) BOOL optional DEPRECATED_MSG_ATTRIBUTE( - "Check if fieldType is GPBFieldTypeSingle and that it is NOT required."); /** Type of field (single, repeated, map). */ @property(nonatomic, readonly) GPBFieldType fieldType; /** Type of the key if the field is a map. The value's type is -dataType. */ diff --git a/objectivec/GPBDescriptor.m b/objectivec/GPBDescriptor.m index a422626b37..ced450b7d3 100644 --- a/objectivec/GPBDescriptor.m +++ b/objectivec/GPBDescriptor.m @@ -630,13 +630,6 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { return (description_->flags & GPBFieldRequired) != 0; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -- (BOOL)isOptional { - return self.fieldType == GPBFieldTypeSingle && !self.isRequired; -} -#pragma clang diagnostic pop - - (GPBFieldType)fieldType { GPBFieldFlags flags = description_->flags; if ((flags & GPBFieldRepeated) != 0) {