@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2021 Jonathan Schleifer + * Copyright (c) 2008-2022 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -25,13 +25,13 @@ + (instancetype)exceptionWithCondition: (OFCondition *)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } -- (instancetype)init ++ (instancetype)exception { - return [self initWithCondition: nil]; + OF_UNRECOGNIZED_SELECTOR } - (instancetype)initWithCondition: (OFCondition *)condition { self = [super init]; @@ -38,10 +38,15 @@ _condition = [condition retain]; return self; } + +- (instancetype)init +{ + OF_INVALID_INIT_METHOD +} - (void)dealloc { [_condition release]; @@ -48,15 +53,11 @@ [super dealloc]; } - (OFString *)description { - if (_condition != nil) - return [OFString stringWithFormat: - @"Deallocation of a condition of type %@ was tried, even " - "though a thread was still waiting for it!", - _condition.class]; - else - return @"Deallocation of a condition was tried, even though a " - "thread was still waiting for it!"; + return [OFString stringWithFormat: + @"Deallocation of a condition of type %@ was tried, even though " + "a thread was still waiting for it!", + _condition.class]; } @end