protocol_getMethodDescription inspects parent protocols

Originator:defagos
Number:rdar://14523118 Date Originated:23-Jul-2013
Status:Closed Resolved:
Product:Documentation Product Version:10.8.4
Classification:Bug Reproducible:Always
 
23-Jul-2013 07:57 PM Samuel Defago:
Summary:

The documentation for protocol_getMethodDescription says that the function does not look at parent protocols when performing method lookup:

"Methods in other protocols adopted by this protocol are not included."

When calling the function, though, parent protocols are taken into account. This is confirmed by having a look at the implementation (http://www.opensource.apple.com/source/objc4/objc4-532.2/runtime/objc-runtime-new.mm)

Either the documentation should be fixed, or the implementation itself.

Steps to Reproduce:

Please run the following code:

#import <Foundation/Foundation.h>

#import <objc/runtime.h>

@protocol ParentProtocol <NSObject>

- (void)parentInstanceMethod;

@end

@protocol ChildProtocol <ParentProtocol>

- (void)childInstanceMethod;

@end

int main(int argc, char *argv[])
{
	@autoreleasepool {
		NSCAssert(protocol_getMethodDescription(@protocol(ChildProtocol), @selector(parentInstanceMethod), YES, YES).name == NULL, @"NULL expected");
	}
}

Expected Results:

No assertion failure

Actual Results:

Assertion failure

Regression:

Notes:

Comments

Resolved through documentation update


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!