aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec
diff options
context:
space:
mode:
authorGravatar Thomas Van Lenten <thomasvl@google.com>2017-11-15 11:02:34 -0500
committerGravatar GitHub <noreply@github.com>2017-11-15 11:02:34 -0500
commitaf5ad246176e6de8661b6a312a42c621c01736f5 (patch)
tree0c937ba4671ad946490bbfea30882e0ac86d2379 /objectivec
parent91ff83c024be36e2f2728c30cd7eedcec9220d1a (diff)
parent37a6672c3195ac9152ffda27c731440ba05bfb97 (diff)
Merge pull request #3882 from dmaclach/removeclass2
Remove unreferenced 'GPBMessageSignatureProtocol' class.
Diffstat (limited to 'objectivec')
-rw-r--r--objectivec/GPBRootObject.m8
-rw-r--r--objectivec/GPBUtilities.m13
-rw-r--r--objectivec/GPBUtilities_PackagePrivate.h3
3 files changed, 13 insertions, 11 deletions
diff --git a/objectivec/GPBRootObject.m b/objectivec/GPBRootObject.m
index 585d205a..bad2f9a7 100644
--- a/objectivec/GPBRootObject.m
+++ b/objectivec/GPBRootObject.m
@@ -43,6 +43,14 @@
- (const char *)singletonNameC;
@end
+// We need some object to conform to the MessageSignatureProtocol to make sure
+// the selectors in it are recorded in our Objective C runtime information.
+// GPBMessage is arguably the more "obvious" choice, but given that all messages
+// inherit from GPBMessage, conflicts seem likely, so we are using GPBRootObject
+// instead.
+@interface GPBRootObject () <GPBMessageSignatureProtocol>
+@end
+
@implementation GPBRootObject
// Taken from http://www.burtleburtle.net/bob/hash/doobs.html
diff --git a/objectivec/GPBUtilities.m b/objectivec/GPBUtilities.m
index 5029ec73..f5f0d019 100644
--- a/objectivec/GPBUtilities.m
+++ b/objectivec/GPBUtilities.m
@@ -1216,8 +1216,11 @@ void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field,
const char *GPBMessageEncodingForSelector(SEL selector, BOOL instanceSel) {
Protocol *protocol =
objc_getProtocol(GPBStringifySymbol(GPBMessageSignatureProtocol));
+ NSCAssert(protocol, @"Missing GPBMessageSignatureProtocol");
struct objc_method_description description =
protocol_getMethodDescription(protocol, selector, NO, instanceSel);
+ NSCAssert(description.name != Nil && description.types != nil,
+ @"Missing method for selector %@", NSStringFromSelector(selector));
return description.types;
}
@@ -1911,13 +1914,3 @@ BOOL GPBClassHasSel(Class aClass, SEL sel) {
free(methodList);
return result;
}
-
-#pragma mark - GPBMessageSignatureProtocol
-
-// A series of selectors that are used solely to get @encoding values
-// for them by the dynamic protobuf runtime code. An object using the protocol
-// needs to be declared for the protocol to be valid at runtime.
-@interface GPBMessageSignatureProtocol : NSObject<GPBMessageSignatureProtocol>
-@end
-@implementation GPBMessageSignatureProtocol
-@end
diff --git a/objectivec/GPBUtilities_PackagePrivate.h b/objectivec/GPBUtilities_PackagePrivate.h
index 16859d48..c8b21ed7 100644
--- a/objectivec/GPBUtilities_PackagePrivate.h
+++ b/objectivec/GPBUtilities_PackagePrivate.h
@@ -309,7 +309,8 @@ NSString *GPBDecodeTextFormatName(const uint8_t *decodeData, int32_t key,
// A series of selectors that are used solely to get @encoding values
// for them by the dynamic protobuf runtime code. See
-// GPBMessageEncodingForSelector for details.
+// GPBMessageEncodingForSelector for details. GPBRootObject conforms to
+// the protocol so that it is encoded in the Objective C runtime.
@protocol GPBMessageSignatureProtocol
@optional