Skip to content

Surpress "multiple methods named" error - #58

Merged
johnezang merged 2 commits into
johnezang:masterfrom
soffes:master
Nov 17, 2011
Merged

johnezang merged 2 commits into
johnezang:masterfrom
soffes:master

Conversation

@soffes

@soffes soffes commented Nov 17, 2011

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

soffes commented Nov 17, 2011

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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

soffes commented Nov 17, 2011

Copy link
Copy Markdown
Contributor Author

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.

2 participants