Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -226,17 +226,12 @@ + (IMP)setImplementation: (IMP)newimp forClassMethod: (SEL)selector { #ifdef OF_APPLE_RUNTIME - Method method; - - if ((method = class_getClassMethod(self, selector)) == NULL) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; - - return method_setImplementation(method, newimp); + return class_replaceMethod(self->isa, selector, newimp, + method_getTypeEncoding(class_getClassMethod(self, selector))); #else Method_t method; IMP oldimp; /* The class method is the instance method of the meta class */ @@ -281,17 +276,12 @@ + (IMP)setImplementation: (IMP)newimp forInstanceMethod: (SEL)selector { #ifdef OF_APPLE_RUNTIME - Method method; - - if ((method = class_getInstanceMethod(self, selector)) == NULL) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; - - return method_setImplementation(method, newimp); + return class_replaceMethod(self, selector, newimp, + method_getTypeEncoding(class_getInstanceMethod(self, selector))); #else Method_t method = class_get_instance_method(self, selector); IMP oldimp; if (method == NULL)