[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
class method forward invocations
From: |
Adam Fedor |
Subject: |
class method forward invocations |
Date: |
Wed, 02 Jan 2002 11:08:50 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:0.9.4) Gecko/20011009 |
In this example, the class forwardInvocation method doesn't get called,
instead I get:
Jan 02 11:04:33 longstring[8059] Got object forwardInvocation
Jan 02 11:04:33 longstring[8059] GSFFCallInvocation.m:754 Assertion
failed in GSInvocationCallback. GSFFCallInvocation: Class 'MyClass'
does not respond to forwardInvocation: for 'intValue'
Uncaught exception NSInternalInconsistencyException, reason:
GSFFCallInvocation.m:754 Assertion failed in GSInvocationCallback.
GSFFCallInvocation: Class 'MyClass' does not respond to
forwardInvocation: for 'intValue'
Aborted (core dumped)
-------------------------------------------------------------------------------
I'm wondering if this fix will create some new problem:
diff -c -r1.15 GSFFCallInvocation.m
*** GSFFCallInvocation.m 17 Dec 2001 14:31:42 -0000 1.15
--- GSFFCallInvocation.m 2 Jan 2002 18:07:28 -0000
***************
*** 215,221 ****
return class_get_instance_method (object_get_class
(receiver), sel);
}
! else if (object_is_meta_class (receiver))
{
return class_get_class_method (object_get_meta_class
(receiver), sel);
--- 215,221 ----
return class_get_instance_method (object_get_class
(receiver), sel);
}
! else if (object_is_class (receiver))
{
return class_get_class_method (object_get_meta_class
(receiver), sel);
-----------------------------------------------------------------------------------
forwardexample.m
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSString.h>
@interface MyClass: NSObject
@end
@implementation MyClass
- (void) forwardInvocation: (NSInvocation*)anInvocation
{
NSLog(@"Got object forwardInvocation");
return;
}
+ (void) forwardInvocation: (NSInvocation*)anInvocation
{
NSLog(@"Got class forwardInvocation");
return;
}
@end
int main (int argc, const char *argv[])
{
CREATE_AUTORELEASE_POOL(pool);
id obj;
int i;
obj = [MyClass new];
i = [obj intValue];
i = [MyClass intValue];
RELEASE(pool);
return 0;
}
--
Adam Fedor, Digital Optics | I'm glad I hate spinach, because
http://www.doc.com | if I didn't, I'd eat it, and you
http://www.gnustep.org | know how I hate the stuff.
- class method forward invocations,
Adam Fedor <=