Skip navigation.
 
mlRe: compiler warning for not fully implementing protocol
FROM : Mark Sanvitale
DATE : Fri Aug 01 12:53:47 2008

I copied your code from Mail and pasted it into a text file.

[ip193:~/Desktop] mas% cc test.m -framework Foundation -o test
test.m:33: warning: incomplete implementation of class 
'PortalActionView'
test.m:33: warning: method definition for '-displayCapture' not found
test.m:33: warning: class 'PortalActionView' does not fully implement 
the 'ReadArchiveClient' protocol

Yes, you are correct that "PortalActionView conforms" is printed out 
when you run the resulting program.  That is exactly my point. 
Everything is fine.  The runtime knows it.  But at build time the 
compiler thinks otherwise.

Of course, perhaps these warnings are not actually being output on 
other systems.  I am running 10.4.11, 'cc --version':
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 
5370).

But, hey, the warnings are harmless and can even be avoided with the 
elegant:

   - (id)displayCapture { return [super displayCapture]; }

I will just write a bug and see what the powers that be think.

Thanks.


On Jul 31, 2008, at 8:13 PM, Adam R. Maxwell wrote:
>
> On Jul 31, 2008, at 4:14 PM, Mark Sanvitale wrote:
>

>> I think I am doing exactly what you say is necessary (i.e. declare 
>> the second method in the superclass's public interface).
>>
>> Here are some code snippets:

>
> Turning your code snippets into a test program, I can't reproduce 
> that compiler warning, or in a trivial test where the superclass 
> declares/implements copyWithZone: and the subclass declares 
> conformance.  If this works for you, what did I miss?
>
>
> // File test.m, compile & run with `cc test.m -framework Foundation 
> -o test && ./test`
> #import <Foundation/Foundation.h>
>
> @protocol PortalTabProtocol
> - (void)refreshDisplay:(id)capture because:(int)trigger;
> @end
>
> @interface PortalTabView : NSObject <PortalTabProtocol>
> - (NSString *)tabName;
> - (void)refreshDisplay:(id)capture because:(int)trigger;
> - (id)displayCapture;
> @end
>
> @protocol ReadArchiveClient
> - (id)displayCapture;
> - (void)processedArchive:(id)archive;
> @end
>
> @interface PortalActionView : PortalTabView <ReadArchiveClient>
> @end
>
> @implementation PortalTabView
>
> - (NSString *)tabName; { return nil; }
> - (void)refreshDisplay:(id)capture because:(int)trigger; {}
> - (id)displayCapture; { return nil; }
>
> @end
>
> @implementation PortalActionView
>
> - (void)processedArchive:(id)archive {}
>
> @end
>
> int main (int argc, char const *argv[])
> {
>    NSAutoreleasePool *pool = [NSAutoreleasePool new];
>
>    id obj = [[PortalActionView alloc] init];
>    if ([obj conformsToProtocol:@protocol(ReadArchiveClient)])
>        NSLog(@"PortalActionView conforms");
>    else
>        NSLog(@"PortalActionView does not conform");
>
>    [pool release];
>    return 0;
> }
>

Related mailsAuthorDate
mlcompiler warning for not fully implementing protocol Mark Sanvitale Jul 31, 20:36
mlRe: compiler warning for not fully implementing protocol Bill Bumgarner Jul 31, 22:13
mlRe: compiler warning for not fully implementing protocol Mark Sanvitale Aug 1, 01:14
mlRe: compiler warning for not fully implementing protocol Kyle Sluder Aug 1, 04:04
mlRe: compiler warning for not fully implementing protocol Adam R. Maxwell Aug 1, 05:13
mlRe: compiler warning for not fully implementing protocol Mark Sanvitale Aug 1, 12:53
mlRe: compiler warning for not fully implementing protocol Adam R. Maxwell Aug 1, 15:47