Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surpress "multiple methods named" error #58

Merged
merged 2 commits into from
Nov 17, 2011
Merged

Surpress "multiple methods named" error #58

merged 2 commits into from
Nov 17, 2011

Conversation

soffes
Copy link
Contributor

@soffes soffes commented Nov 17, 2011

I realize that collection won't always be an NSArray, but the cast will let the compiler know to expect a NSUInteger return type instead of size_t which is also a return type a method named count inside of JSONKit.

I realize that `collection` won't always be an NSArray, but the cast will let the compiler know to expect a NSUInteger return type instead of `size_t` which is also a return type a method named `count` inside of JSONKit.
@johnezang
Copy link
Owner

Well, actually, collection will never be a NSArray.. :) It will always be a JKDictionary or a subclass, but the documentation specifically states that JKDictionary is a private, internal class that must not be subclassed, so...

Technically, this is the count method that's being called, since JKDictionary is (obviously) a concrete class of the NSDictionary class cluster. The cast you added is part of the NSEnumerator object, which is needed to implement the required class cluster primitive method keyEnumerator (see also Methods to Override).

I don't mind the pull request, but you should change it to (NSDictionary *). :) Also, can you post the specific warning you were getting? I did a quick check with grep, both of JSONKit and Foundation/Headers/*, and I didn't see an obvious conflict, but there was a lot of cruft to sort through.

@soffes
Copy link
Contributor Author

soffes commented Nov 17, 2011

Here's the error:

/Users/samsoffes/Code/synthetic/REDACTED_APP/Vendor/JSONKit/JSONKit.m:851:22:{851:22-851:40}: error: multiple methods named 'count' found [-Werror,3]
   NSUInteger count = [collection count], atObject = 0UL;
                      ^~~~~~~~~~~~~~~~~~
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:16:1:{16:1-16:21}: note: using
 - (NSUInteger)count;
 ^~~~~~~~~~~~~~~~~~~~
/Users/samsoffes/Code/synthetic/REDACTED_APP/Vendor/HipstaProcessor/HipstaProcessor/HPKernel.h:19:49:{19:49-19:54}: note: also found
 @property (nonatomic, assign, readonly) int16_t count;
                                                 ^~~~~
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIVector.h:61:1:{61:1-61:17}: note: also found
 - (size_t)count;
 ^~~~~~~~~~~~~~~~
1 error generated.

@johnezang
Copy link
Owner

Ah, well, that explains why I didn't find it, and why it never tickled a compiler warning for me. I usually make an effort to crank up the compiler warnings to crazy levels before committing something to the repo, but you can't catch them all. For practical reasons, I only test against the "common" frameworks, and CoreImage doesn't make the cut. :)

johnezang added a commit that referenced this pull request Nov 17, 2011
Surpress "multiple methods named" error
@johnezang johnezang merged commit e3f9017 into johnezang:master Nov 17, 2011
@ghost ghost assigned johnezang Nov 17, 2011
@soffes
Copy link
Contributor Author

soffes commented Nov 17, 2011

Haha definitely. Thanks for merging :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants