Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -108,11 +108,11 @@ @implementation OFArray + (void)initialize { if (self == [OFArray class]) - placeholder.isa = [OFPlaceholderArray class]; + object_setClass((id)&placeholder, [OFPlaceholderArray class]); } + (instancetype)alloc { if (self == [OFArray class]) @@ -156,11 +156,12 @@ count: count] autorelease]; } - (instancetype)init { - if ([self isMemberOfClass: [OFArray class]]) { + if ([self isMemberOfClass: [OFArray class]] || + [self isMemberOfClass: [OFMutableArray class]]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { [self release]; @throw e; Index: src/OFBlock.m ================================================================== --- src/OFBlock.m +++ src/OFBlock.m @@ -162,11 +162,11 @@ # endif #endif static struct { Class isa; -} alloc_failed_exception; +} allocFailedException; #ifndef OF_HAVE_ATOMIC_OPS # define numSpinlocks 8 /* needs to be a power of 2 */ # define SPINLOCK_HASH(p) ((uintptr_t)p >> 4) & (numSpinlocks - 1) static OFSpinlock blockSpinlocks[numSpinlocks]; @@ -180,14 +180,13 @@ if ([(id)block isMemberOfClass: (Class)&_NSConcreteStackBlock]) { struct Block *copy; if ((copy = malloc(block->descriptor->size)) == NULL) { - alloc_failed_exception.isa = - [OFAllocFailedException class]; - @throw (OFAllocFailedException *) - &alloc_failed_exception; + object_setClass((id)&allocFailedException, + [OFAllocFailedException class]); + @throw (OFAllocFailedException *)&allocFailedException; } memcpy(copy, block, block->descriptor->size); object_setClass((id)copy, (Class)&_NSConcreteMallocBlock); copy->flags++; @@ -269,14 +268,14 @@ src = src->forwarding; if ((src->flags & OFBlockRefCountMask) == 0) { if ((*dst = malloc(src->size)) == NULL) { - alloc_failed_exception.isa = - [OFAllocFailedException class]; + object_setClass((id)&allocFailedException, + [OFAllocFailedException class]); @throw (OFAllocFailedException *) - &alloc_failed_exception; + &allocFailedException; } memcpy(*dst, src, src->size); (*dst)->flags = ((*dst)->flags & ~OFBlockRefCountMask) | 1; Index: src/OFCharacterSet.m ================================================================== --- src/OFCharacterSet.m +++ src/OFCharacterSet.m @@ -77,14 +77,13 @@ @end @implementation OFCharacterSet + (void)initialize { - if (self != [OFCharacterSet class]) - return; - - placeholder.isa = [OFPlaceholderCharacterSet class]; + if (self == [OFCharacterSet class]) + object_setClass((id)&placeholder, + [OFPlaceholderCharacterSet class]); } + (instancetype)alloc { if (self == [OFCharacterSet class]) Index: src/OFColor.m ================================================================== --- src/OFColor.m +++ src/OFColor.m @@ -122,11 +122,11 @@ + (void)initialize { if (self != [OFColor class]) return; - placeholder.isa = [OFColorPlaceholder class]; + object_setClass((id)&placeholder, [OFColorPlaceholder class]); #ifdef OF_OBJFW_RUNTIME colorTag = objc_registerTaggedPointerClass([OFTaggedPointerColor class]); #endif } Index: src/OFCountedSet.m ================================================================== --- src/OFCountedSet.m +++ src/OFCountedSet.m @@ -92,11 +92,12 @@ @implementation OFCountedSet + (void)initialize { if (self == [OFCountedSet class]) - placeholder.isa = [OFCountedSetPlaceholder class]; + object_setClass((id)&placeholder, + [OFCountedSetPlaceholder class]); } + (instancetype)alloc { if (self == [OFCountedSet class]) @@ -103,26 +104,10 @@ return (id)&placeholder; return [super alloc]; } -- (instancetype)init -{ - if ([self isMemberOfClass: [OFCountedSet class]]) { - @try { - [self doesNotRecognizeSelector: _cmd]; - } @catch (id e) { - [self release]; - @throw e; - } - - abort(); - } - - return [super init]; -} - - (size_t)countForObject: (id)object { OF_UNRECOGNIZED_SELECTOR } Index: src/OFData.m ================================================================== --- src/OFData.m +++ src/OFData.m @@ -127,11 +127,11 @@ @implementation OFData + (void)initialize { if (self == [OFData class]) - placeholder.isa = [OFDataPlaceholder class]; + object_setClass((id)&placeholder, [OFDataPlaceholder class]); } + (instancetype)alloc { if (self == [OFData class]) @@ -207,11 +207,12 @@ return [[[self alloc] initWithBase64EncodedString: string] autorelease]; } - (instancetype)init { - if ([self isMemberOfClass: [OFData class]]) { + if ([self isMemberOfClass: [OFData class]] || + [self isMemberOfClass: [OFMutableData class]]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { [self release]; @throw e; Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -342,11 +342,11 @@ #endif if (self != [OFDate class]) return; - placeholder.isa = [OFDatePlaceholder class]; + object_setClass((id)&placeholder, [OFDatePlaceholder class]); #if (!defined(HAVE_GMTIME_R) || !defined(HAVE_LOCALTIME_R)) && \ defined(OF_HAVE_THREADS) mutex = [[OFMutex alloc] init]; atexit(releaseMutex); Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -127,11 +127,12 @@ @implementation OFDictionary + (void)initialize { if (self == [OFDictionary class]) - placeholder.isa = [OFDictionaryPlaceholder class]; + object_setClass((id)&placeholder, + [OFDictionaryPlaceholder class]); } + (instancetype)alloc { if (self == [OFDictionary class]) @@ -185,11 +186,12 @@ return ret; } - (instancetype)init { - if ([self isMemberOfClass: [OFDictionary class]]) { + if ([self isMemberOfClass: [OFDictionary class]] || + [self isMemberOfClass: [OFMutableDictionary class]]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { [self release]; @throw e; Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -146,11 +146,12 @@ @implementation OFMutableArray + (void)initialize { if (self == [OFMutableArray class]) - placeholder.isa = [OFMutableArrayPlaceholder class]; + object_setClass((id)&placeholder, + [OFMutableArrayPlaceholder class]); } + (instancetype)alloc { if (self == [OFMutableArray class]) @@ -162,25 +163,10 @@ + (instancetype)arrayWithCapacity: (size_t)capacity { return [[[self alloc] initWithCapacity: capacity] autorelease]; } -- (instancetype)init -{ - if ([self isMemberOfClass: [OFMutableArray class]]) { - @try { - [self doesNotRecognizeSelector: _cmd]; - abort(); - } @catch (id e) { - [self release]; - @throw e; - } - } - - return [super init]; -} - - (instancetype)initWithCapacity: (size_t)capacity { OF_INVALID_INIT_METHOD } Index: src/OFMutableData.m ================================================================== --- src/OFMutableData.m +++ src/OFMutableData.m @@ -117,11 +117,12 @@ @implementation OFMutableData + (void)initialize { if (self == [OFMutableData class]) - placeholder.isa = [OFMutableDataPlaceholder class]; + object_setClass((id)&placeholder, + [OFMutableDataPlaceholder class]); } + (instancetype)alloc { if (self == [OFMutableData class]) Index: src/OFMutableDictionary.m ================================================================== --- src/OFMutableDictionary.m +++ src/OFMutableDictionary.m @@ -108,11 +108,12 @@ @implementation OFMutableDictionary + (void)initialize { if (self == [OFMutableDictionary class]) - placeholder.isa = [OFMutableDictionaryPlaceholder class]; + object_setClass((id)&placeholder, + [OFMutableDictionaryPlaceholder class]); } + (instancetype)alloc { if (self == [OFMutableDictionary class]) @@ -124,26 +125,10 @@ + (instancetype)dictionaryWithCapacity: (size_t)capacity { return [[[self alloc] initWithCapacity: capacity] autorelease]; } -- (instancetype)init -{ - if ([self isMemberOfClass: [OFMutableDictionary class]]) { - @try { - [self doesNotRecognizeSelector: _cmd]; - } @catch (id e) { - [self release]; - @throw e; - } - - abort(); - } - - return [super init]; -} - - (instancetype)initWithCapacity: (size_t)capacity { OF_INVALID_INIT_METHOD } Index: src/OFMutableSet.m ================================================================== --- src/OFMutableSet.m +++ src/OFMutableSet.m @@ -96,11 +96,12 @@ @implementation OFMutableSet + (void)initialize { if (self == [OFMutableSet class]) - placeholder.isa = [OFMutableSetPlaceholder class]; + object_setClass((id)&placeholder, + [OFMutableSetPlaceholder class]); } + (instancetype)alloc { if (self == [OFMutableSet class]) @@ -112,25 +113,10 @@ + (instancetype)setWithCapacity: (size_t)capacity { return [[[self alloc] initWithCapacity: capacity] autorelease]; } -- (instancetype)init -{ - if ([self isMemberOfClass: [OFMutableSet class]]) { - @try { - [self doesNotRecognizeSelector: _cmd]; - abort(); - } @catch (id e) { - [self release]; - @throw e; - } - } - - return [super init]; -} - - (instancetype)initWithCapacity: (size_t)capacity { OF_INVALID_INIT_METHOD } Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -209,11 +209,12 @@ @implementation OFMutableString + (void)initialize { if (self == [OFMutableString class]) - placeholder.isa = [OFMutableStringPlaceholder class]; + object_setClass((id)&placeholder, + [OFMutableStringPlaceholder class]); } + (instancetype)alloc { if (self == [OFMutableString class]) Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -482,11 +482,11 @@ + (void)initialize { if (self != [OFNumber class]) return; - placeholder.isa = [OFNumberPlaceholder class]; + object_setClass((id)&placeholder, [OFNumberPlaceholder class]); #ifdef OF_OBJFW_RUNTIME numberTag = objc_registerTaggedPointerClass([OFTaggedPointerNumber class]); #endif Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -341,11 +341,12 @@ instance = calloc(1, PRE_IVARS_ALIGN + instanceSize + extraAlignment + extraSize); if OF_UNLIKELY (instance == nil) { - allocFailedException.isa = [OFAllocFailedException class]; + object_setClass((id)&allocFailedException, + [OFAllocFailedException class]); @throw (id)&allocFailedException; } ((struct PreIvars *)instance)->retainCount = 1; Index: src/OFSet.m ================================================================== --- src/OFSet.m +++ src/OFSet.m @@ -17,10 +17,11 @@ #include #import "OFSet.h" #import "OFArray.h" +#import "OFCountedSet.h" #import "OFMapTableSet.h" #import "OFNull.h" #import "OFString.h" static struct { @@ -93,11 +94,11 @@ @implementation OFSet + (void)initialize { if (self == [OFSet class]) - placeholder.isa = [OFSetPlaceholder class]; + object_setClass((id)&placeholder, [OFSetPlaceholder class]); } + (instancetype)alloc { if (self == [OFSet class]) @@ -140,11 +141,13 @@ count: count] autorelease]; } - (instancetype)init { - if ([self isMemberOfClass: [OFSet class]]) { + if ([self isMemberOfClass: [OFSet class]] || + [self isMemberOfClass: [OFMutableSet class]] || + [self isMemberOfClass: [OFCountedSet class]]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { [self release]; @throw e; Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -616,11 +616,11 @@ + (void)initialize { if (self != [OFString class]) return; - placeholder.isa = [OFStringPlaceholder class]; + object_setClass((id)&placeholder, [OFStringPlaceholder class]); #if defined(HAVE_STRTOF_L) || defined(HAVE_STRTOD_L) || defined(HAVE_USELOCALE) if ((cLocale = newlocale(LC_ALL_MASK, "C", NULL)) == NULL) @throw [OFInitializationFailedException exceptionWithClass: self]; @@ -801,11 +801,12 @@ encoding: encoding] autorelease]; } - (instancetype)init { - if ([self isMemberOfClass: [OFString class]]) { + if ([self isMemberOfClass: [OFString class]] || + [self isMemberOfClass: [OFMutableString class]]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { [self release]; @throw e;