Objective-C 2: counterproductive property attribute warnings
Originator: | jens.ayton | ||
Number: | rdar://6588319 | Date Originated: | 2009-02-14 |
Status: | Duplicate/7049802 | Resolved: | |
Product: | Developer tools | Product Version: | Xcode tools 3.0 and later |
Classification: | Other bug | Reproducible: | Always |
Consider the following code: #import <Foundation/Foundation.h> @interface Foo: NSObject { id bar; } @property (readonly) id bar; @end @interface Foo () @property (readwrite, retain) id bar; @end int main (int argc, const char * argv[]) { return 0; } It generates the following warning for the second @property line: “warning: property 'bar' attribute in 'Foo' class continuation does not match class 'Foo' property” Adding “retain” to the first property declaration squelches the warning. While there are obviously cases where this is a useful warning, I contend that this is not one of them. As far as I can see attributes retain, copy and assign are not relevant to getters, and should therefore not need to be specified in the public interface. [Comments regarding beta iPhone SDKs redacted]
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!