Skip to content

Commit

Permalink
Merge pull request protocolbuffers#3882 from dmaclach/removeclass2
Browse files Browse the repository at this point in the history
Remove unreferenced 'GPBMessageSignatureProtocol' class.
  • Loading branch information
thomasvl authored Nov 15, 2017
2 parents 91ff83c + 37a6672 commit af5ad24
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
8 changes: 8 additions & 0 deletions objectivec/GPBRootObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ @interface GPBExtensionDescriptor (GPBRootObject)
- (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
Expand Down
13 changes: 3 additions & 10 deletions objectivec/GPBUtilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion objectivec/GPBUtilities_PackagePrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit af5ad24

Please sign in to comment.