Some methods in NSObject protocol are now declared as properties, this has some annoying consequences

Originator:ScrimpyCat
Number:rdar://18072458 Date Originated:August 20 2014
Status:Open Resolved:No
Product:iOS SDK and OS X SDK Product Version:Xcode 6 beta 6
Classification:Other Bug Reproducible:Yes
 
Summary:
In this beta the NSObject protocol has been changed slightly so some methods are now declared as properties. This has the unfortunate problem of causing scenarios where obtaining the property list (class_copyPropertyList) of a class that implements a protocol that inherits the NSObject protocol, to also include those properties.

Steps to Reproduce:
//Code to reproduce
@protocol A <NSObject>
@property int test;
@end

@interface A : NSObject <A>
@end
@implementation A
@synthesize test;
@end


//in main (or wherever)
unsigned int Count;
objc_property_t *Properties =  class_copyPropertyList([A class], &Count);

for (unsigned int Loop = 0; Loop < Count; Loop++)
{
    printf("%s\n", property_getName(Properties[Loop]));
}

free(Properties);

Expected Results:
In previous version it would just print the following:
test

Actual Results:
It will now print the following:
hash
superclass
description
debugDescription
test

Notes:
While this is filed as an iOS bug, it's also for OS X.

This isn't necessarily a call to reverse this change, more so just a notice to make you aware of the potential issue. It's caused some previous codebases to have unintended results. While this can easily be alleviated, I'm really just checking to see if this was the intended functionality (for these methods to now be properties).

Comments


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!