@@ -122,13 +122,16 @@ } void of_method_not_found(id obj, SEL sel) { - fprintf(stderr, "Runtime error: Selector %s is not implemented in " - "class %s!\n", sel_getName(sel), - class_getName(object_getClass(obj))); + [obj doesNotRecognizeSelector: sel]; + + /* + * Just in case doesNotRecognizeSelector: returned, even though it must + * never return. + */ abort(); } #ifdef OF_OBJFW_RUNTIME static IMP @@ -974,10 +977,16 @@ - (id)forwardingTargetForSelector: (SEL)selector { return nil; } + +- (void)doesNotRecognizeSelector: (SEL)selector +{ + @throw [OFNotImplementedException exceptionWithClass: [self class] + selector: selector]; +} - retain { #if defined(OF_ATOMIC_OPS) of_atomic_inc_32(&PRE_IVARS->retainCount); @@ -1059,24 +1068,24 @@ } /* Required to use properties with the Apple runtime */ - copyWithZone: (void*)zone { - if OF_UNLIKELY (zone != NULL) - @throw [OFNotImplementedException - exceptionWithClass: [self class] - selector: _cmd]; + if OF_UNLIKELY (zone != NULL) { + [self doesNotRecognizeSelector: _cmd]; + abort(); + } return [(id)self copy]; } - mutableCopyWithZone: (void*)zone { - if OF_UNLIKELY (zone != NULL) - @throw [OFNotImplementedException - exceptionWithClass: [self class] - selector: _cmd]; + if OF_UNLIKELY (zone != NULL) { + [self doesNotRecognizeSelector: _cmd]; + abort(); + } return [(id)self mutableCopy]; } /* @@ -1083,40 +1092,40 @@ * Those are needed as the root class is the superclass of the root class's * metaclass and thus instance methods can be sent to class objects as well. */ + (void*)allocMemoryWithSize: (size_t)size { - @throw [OFNotImplementedException exceptionWithClass: self - selector: _cmd]; + [self doesNotRecognizeSelector: _cmd]; + abort(); } + (void*)allocMemoryWithSize: (size_t)size count: (size_t)count { - @throw [OFNotImplementedException exceptionWithClass: self - selector: _cmd]; + [self doesNotRecognizeSelector: _cmd]; + abort(); } + (void*)resizeMemory: (void*)pointer size: (size_t)size { - @throw [OFNotImplementedException exceptionWithClass: self - selector: _cmd]; + [self doesNotRecognizeSelector: _cmd]; + abort(); } + (void*)resizeMemory: (void*)pointer size: (size_t)size count: (size_t)count { - @throw [OFNotImplementedException exceptionWithClass: self - selector: _cmd]; + [self doesNotRecognizeSelector: _cmd]; + abort(); } + (void)freeMemory: (void*)pointer { - @throw [OFNotImplementedException exceptionWithClass: self - selector: _cmd]; + [self doesNotRecognizeSelector: _cmd]; + abort(); } + retain { return self; @@ -1136,21 +1145,21 @@ { } + (void)dealloc { - @throw [OFNotImplementedException exceptionWithClass: self - selector: _cmd]; + [self doesNotRecognizeSelector: _cmd]; + abort(); } + copyWithZone: (void*)zone { - @throw [OFNotImplementedException exceptionWithClass: self - selector: _cmd]; + [self doesNotRecognizeSelector: _cmd]; + abort(); } + mutableCopyWithZone: (void*)zone { - @throw [OFNotImplementedException exceptionWithClass: self - selector: _cmd]; + [self doesNotRecognizeSelector: _cmd]; + abort(); } @end