Index: src/OFKernelEventObserver_epoll.m ================================================================== --- src/OFKernelEventObserver_epoll.m +++ src/OFKernelEventObserver_epoll.m @@ -49,16 +49,18 @@ @try { struct epoll_event event; #ifdef HAVE_EPOLL_CREATE1 if ((_epfd = epoll_create1(EPOLL_CLOEXEC)) == -1) - @throw [OFInitializationFailedException exception]; + @throw [OFInitializationFailedException + exceptionWithClass: [self class]]; #else int flags; if ((_epfd = epoll_create(1)) == -1) - @throw [OFInitializationFailedException exception]; + @throw [OFInitializationFailedException + exceptionWithClass: [self class]]; if ((flags = fcntl(_epfd, F_GETFD, 0)) != -1) fcntl(_epfd, F_SETFD, flags | FD_CLOEXEC); #endif @@ -69,11 +71,12 @@ memset(&event, 0, sizeof(event)); event.events = EPOLLIN; event.data.ptr = [OFNull null]; if (epoll_ctl(_epfd, EPOLL_CTL_ADD, _cancelFD[0], &event) == -1) - @throw [OFInitializationFailedException exception]; + @throw [OFInitializationFailedException + exceptionWithClass: [self class]]; } @catch (id e) { [self release]; @throw e; } Index: src/OFKernelEventObserver_select.m ================================================================== --- src/OFKernelEventObserver_select.m +++ src/OFKernelEventObserver_select.m @@ -47,11 +47,12 @@ { self = [super init]; #ifndef OF_WINDOWS if (_cancelFD[0] >= (int)FD_SETSIZE) - @throw [OFInitializationFailedException exception]; + @throw [OFInitializationFailedException + exceptionWithClass: [self class]]; #endif FD_ZERO(&_readFDs); FD_ZERO(&_writeFDs); FD_SET(_cancelFD[0], &_readFDs); Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -588,11 +588,12 @@ placeholder.isa = [OFString_placeholder class]; #if defined(HAVE_STRTOF_L) || defined(HAVE_STRTOD_L) if ((cLocale = newlocale(LC_ALL_MASK, "C", NULL)) == NULL) - @throw [OFInitializationFailedException exception]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; #endif } + alloc { Index: src/exceptions/OFAcceptFailedException.h ================================================================== --- src/exceptions/OFAcceptFailedException.h +++ src/exceptions/OFAcceptFailedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFAcceptFailedException \ * OFAcceptFailedException.h ObjFW/OFAcceptFailedException.h * * @brief An exception indicating that accepting a connection failed. @@ -60,5 +62,7 @@ * @return An initialized accept failed exception */ - initWithSocket: (id)socket errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFAddressTranslationFailedException.h ================================================================== --- src/exceptions/OFAddressTranslationFailedException.h +++ src/exceptions/OFAddressTranslationFailedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFAddressTranslationFailedException \ * OFAddressTranslationFailedException.h \ * ObjFW/OFAddressTranslationFailedException.h * @@ -34,31 +36,33 @@ } /*! * The host for which the address translation was requested. */ -@property (readonly, nonatomic) OFString *host; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *host; /*! * @brief Creates a new, autoreleased address translation failed exception. * * @param host The host for which translation was requested * @return A new, autoreleased address translation failed exception */ -+ (instancetype)exceptionWithHost: (OFString*)host; ++ (instancetype)exceptionWithHost: (nullable OFString*)host; -+ (instancetype)exceptionWithHost: (OFString*)host ++ (instancetype)exceptionWithHost: (nullable OFString*)host error: (int)error; + (instancetype)exceptionWithError: (int)error; /*! * @brief Initializes an already allocated address translation failed exception. * * @param host The host for which translation was requested * @return An initialized address translation failed exception */ -- initWithHost: (OFString*)host; +- initWithHost: (nullable OFString*)host; -- (instancetype)initWithHost: (OFString*)host +- (instancetype)initWithHost: (nullable OFString*)host error: (int)error; - (instancetype)initWithError: (int)error; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFAddressTranslationFailedException.m ================================================================== --- src/exceptions/OFAddressTranslationFailedException.m +++ src/exceptions/OFAddressTranslationFailedException.m @@ -39,11 +39,12 @@ { if (self != [OFAddressTranslationFailedException class]) return; if (!of_mutex_new(&mutex)) - @throw [OFInitializationFailedException exception]; + @throw [OFInitializationFailedException + exceptionWithClass: class]; } #endif + (instancetype)exceptionWithHost: (OFString*)host { Index: src/exceptions/OFAllocFailedException.h ================================================================== --- src/exceptions/OFAllocFailedException.h +++ src/exceptions/OFAllocFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFObject.h" +OF_ASSUME_NONNULL_BEGIN + @class OFString; /*! * @class OFAllocFailedException \ * OFAllocFailedException.h ObjFW/OFAllocFailedException.h @@ -39,5 +41,7 @@ * * @return A description of the exception */ - (OFString*)description; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFAlreadyConnectedException.h ================================================================== --- src/exceptions/OFAlreadyConnectedException.h +++ src/exceptions/OFAlreadyConnectedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFAlreadyConnectedException \ * OFAlreadyConnectedException.h ObjFW/OFAlreadyConnectedException.h * * @brief An exception indicating an attempt to connect or bind an already @@ -33,23 +35,25 @@ } /*! * The socket which is already connected. */ -@property (readonly, nonatomic) id socket; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) id socket; /*! * @brief Creates a new, autoreleased already connected exception. * * @param socket The socket which is already connected * @return A new, autoreleased already connected exception */ -+ (instancetype)exceptionWithSocket: (id)socket; ++ (instancetype)exceptionWithSocket: (nullable id)socket; /*! * @brief Initializes an already allocated already connected exception. * * @param socket The socket which is already connected * @return An initialized already connected exception */ -- initWithSocket: (id)socket; +- initWithSocket: (nullable id)socket; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFBindFailedException.h ================================================================== --- src/exceptions/OFBindFailedException.h +++ src/exceptions/OFBindFailedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFBindFailedException \ * OFBindFailedException.h ObjFW/OFBindFailedException.h * * @brief An exception indicating that binding a socket failed. @@ -80,5 +82,7 @@ - initWithHost: (OFString*)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFChangeCurrentDirectoryPathFailedException.h ================================================================== --- src/exceptions/OFChangeCurrentDirectoryPathFailedException.h +++ src/exceptions/OFChangeCurrentDirectoryPathFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFChangeCurrentDirectoryPathFailedException \ * OFChangeCurrentDirectoryPathFailedException.h \ * ObjFW/OFChangeCurrentDirectoryPathFailedException.h * @@ -61,5 +63,7 @@ * @return An initialized change current directory path failed exception */ - initWithPath: (OFString*)path errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFChangeOwnerFailedException.h ================================================================== --- src/exceptions/OFChangeOwnerFailedException.h +++ src/exceptions/OFChangeOwnerFailedException.h @@ -14,11 +14,12 @@ * file. */ #import "OFException.h" -#ifdef OF_HAVE_CHOWN +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFChangeOwnerFailedException \ * OFChangeOwnerFailedException.h ObjFW/OFChangeOwnerFailedException.h * * @brief An exception indicating that changing the owner of an item failed. @@ -35,16 +36,16 @@ @property (readonly, nonatomic) OFString *path; /*! * The new owner for the item. */ -@property (readonly, nonatomic) OFString *owner; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *owner; /*! * The new group for the item. */ -@property (readonly, nonatomic) OFString *group; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *group; /*! * The errno of the error that occurred. */ @property (readonly) int errNo; @@ -57,12 +58,12 @@ * @param group The new group for the item * @param errNo The errno of the error that occurred * @return A new, autoreleased change owner failed exception */ + (instancetype)exceptionWithPath: (OFString*)path - owner: (OFString*)owner - group: (OFString*)group + owner: (nullable OFString*)owner + group: (nullable OFString*)group errNo: (int)errNo; /*! * @brief Initializes an already allocated change owner failed exception. * @@ -71,10 +72,11 @@ * @param group The new group for the item * @param errNo The errno of the error that occurred * @return An initialized change owner failed exception */ - initWithPath: (OFString*)path - owner: (OFString*)owner - group: (OFString*)group + owner: (nullable OFString*)owner + group: (nullable OFString*)group errNo: (int)errNo; @end -#endif + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFChangeOwnerFailedException.m ================================================================== --- src/exceptions/OFChangeOwnerFailedException.m +++ src/exceptions/OFChangeOwnerFailedException.m @@ -17,11 +17,10 @@ #include "config.h" #import "OFChangeOwnerFailedException.h" #import "OFString.h" -#ifdef OF_HAVE_CHOWN @implementation OFChangeOwnerFailedException @synthesize path = _path, owner = _owner, group = _group, errNo = _errNo; + (instancetype)exceptionWithPath: (OFString*)path owner: (OFString*)owner @@ -82,6 +81,5 @@ return [OFString stringWithFormat: @"Failed to change owner of item at path %@ to %@:%@: %@", _path, _owner, _group, of_strerror(_errNo)]; } @end -#endif Index: src/exceptions/OFChangePermissionsFailedException.h ================================================================== --- src/exceptions/OFChangePermissionsFailedException.h +++ src/exceptions/OFChangePermissionsFailedException.h @@ -16,10 +16,12 @@ #include #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFChangePermissionsFailedException \ * OFChangePermissionsFailedException.h \ * ObjFW/OFChangePermissionsFailedException.h * @@ -70,5 +72,7 @@ */ - initWithPath: (OFString*)path permissions: (mode_t)permissions errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFChecksumFailedException.h ================================================================== --- src/exceptions/OFChecksumFailedException.h +++ src/exceptions/OFChecksumFailedException.h @@ -14,13 +14,17 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFChecksumFailedException \ * OFChecksumFailedException.h ObjFW/OFChecksumFailedException.h * * @brief An exception indicating that a checksum did not match. */ @interface OFChecksumFailedException: OFException @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFConditionBroadcastFailedException.h ================================================================== --- src/exceptions/OFConditionBroadcastFailedException.h +++ src/exceptions/OFConditionBroadcastFailedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_THREADS # error No threads available! #endif +OF_ASSUME_NONNULL_BEGIN + @class OFCondition; /*! * @class OFConditionBroadcastFailedException \ * OFConditionBroadcastFailedException.h \ @@ -35,23 +37,25 @@ } /*! * The condition which could not be broadcasted. */ -@property (readonly, nonatomic) OFCondition *condition; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFCondition *condition; /*! * @brief Returns a new, autoreleased condition broadcast failed exception. * * @param condition The condition which could not be broadcasted * @return A new, autoreleased condition broadcast failed exception */ -+ (instancetype)exceptionWithCondition: (OFCondition*)condition; ++ (instancetype)exceptionWithCondition: (nullable OFCondition*)condition; /*! * @brief Initializes an already allocated condition broadcast failed exception. * * @param condition The condition which could not be broadcasted * @return An initialized condition broadcast failed exception */ -- initWithCondition: (OFCondition*)condition; +- initWithCondition: (nullable OFCondition*)condition; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFConditionBroadcastFailedException.m ================================================================== --- src/exceptions/OFConditionBroadcastFailedException.m +++ src/exceptions/OFConditionBroadcastFailedException.m @@ -26,15 +26,10 @@ + (instancetype)exceptionWithCondition: (OFCondition*)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } -- init -{ - OF_INVALID_INIT_METHOD -} - - initWithCondition: (OFCondition*)condition { self = [super init]; _condition = [condition retain]; @@ -49,9 +44,13 @@ [super dealloc]; } - (OFString*)description { - return [OFString stringWithFormat: - @"Broadcasting a condition of type %@ failed!", [_condition class]]; + if (_condition != nil) + return [OFString stringWithFormat: + @"Broadcasting a condition of type %@ failed!", + [_condition class]]; + else + return @"Broadcasting a condition failed!"; } @end Index: src/exceptions/OFConditionSignalFailedException.h ================================================================== --- src/exceptions/OFConditionSignalFailedException.h +++ src/exceptions/OFConditionSignalFailedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_THREADS # error No threads available! #endif +OF_ASSUME_NONNULL_BEGIN + @class OFCondition; /*! * @class OFConditionSignalFailedException \ * OFConditionSignalFailedException.h \ @@ -35,23 +37,25 @@ } /*! * The condition which could not be signaled. */ -@property (readonly, nonatomic) OFCondition *condition; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFCondition *condition; /*! * @brief Creates a new, autoreleased condition signal failed exception. * * @param condition The condition which could not be signaled * @return A new, autoreleased condition signal failed exception */ -+ (instancetype)exceptionWithCondition: (OFCondition*)condition; ++ (instancetype)exceptionWithCondition: (nullable OFCondition*)condition; /*! * @brief Initializes an already allocated condition signal failed exception. * * @param condition The condition which could not be signaled * @return An initialized condition signal failed exception */ -- initWithCondition: (OFCondition*)condition; +- initWithCondition: (nullable OFCondition*)condition; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFConditionSignalFailedException.m ================================================================== --- src/exceptions/OFConditionSignalFailedException.m +++ src/exceptions/OFConditionSignalFailedException.m @@ -26,15 +26,10 @@ + (instancetype)exceptionWithCondition: (OFCondition*)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } -- init -{ - OF_INVALID_INIT_METHOD -} - - initWithCondition: (OFCondition*)condition { self = [super init]; _condition = [condition retain]; @@ -49,9 +44,13 @@ [super dealloc]; } - (OFString*)description { - return [OFString stringWithFormat: - @"Signaling a condition of type %@ failed!", [_condition class]]; + if (_condition != nil) + return [OFString stringWithFormat: + @"Signaling a condition of type %@ failed!", + [_condition class]]; + else + return @"Signaling a condition failed!"; } @end Index: src/exceptions/OFConditionStillWaitingException.h ================================================================== --- src/exceptions/OFConditionStillWaitingException.h +++ src/exceptions/OFConditionStillWaitingException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_THREADS # error No threads available! #endif +OF_ASSUME_NONNULL_BEGIN + @class OFCondition; /*! * @class OFConditionStillWaitingException \ * OFConditionStillWaitingException.h \ @@ -36,23 +38,25 @@ } /*! * The condition for which is still being waited. */ -@property (readonly, nonatomic) OFCondition *condition; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFCondition *condition; /*! * @brief Creates a new, autoreleased condition still waiting exception. * * @param condition The condition for which is still being waited * @return A new, autoreleased condition still waiting exception */ -+ (instancetype)exceptionWithCondition: (OFCondition*)condition; ++ (instancetype)exceptionWithCondition: (nullable OFCondition*)condition; /*! * @brief Initializes an already allocated condition still waiting exception. * * @param condition The condition for which is still being waited * @return An initialized condition still waiting exception */ -- initWithCondition: (OFCondition*)condition; +- initWithCondition: (nullable OFCondition*)condition; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFConditionStillWaitingException.m ================================================================== --- src/exceptions/OFConditionStillWaitingException.m +++ src/exceptions/OFConditionStillWaitingException.m @@ -26,15 +26,10 @@ + (instancetype)exceptionWithCondition: (OFCondition*)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } -- init -{ - OF_INVALID_INIT_METHOD -} - - initWithCondition: (OFCondition*)condition { self = [super init]; _condition = [condition retain]; @@ -49,10 +44,15 @@ [super dealloc]; } - (OFString*)description { - return [OFString stringWithFormat: - @"Deallocation of a condition of type %@ was tried, even though a " - @"thread was still waiting for it!", [_condition class]]; + 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!"; } @end Index: src/exceptions/OFConditionWaitFailedException.h ================================================================== --- src/exceptions/OFConditionWaitFailedException.h +++ src/exceptions/OFConditionWaitFailedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_THREADS # error No threads available! #endif +OF_ASSUME_NONNULL_BEGIN + @class OFCondition; /*! * @class OFConditionWaitFailedException \ * OFConditionWaitFailedException.h \ @@ -35,23 +37,25 @@ } /*! * The condition for which could not be waited. */ -@property (readonly, nonatomic) OFCondition *condition; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFCondition *condition; /*! * @brief Creates a new, autoreleased condition wait failed exception. * * @param condition The condition for which could not be waited * @return A new, autoreleased condition wait failed exception */ -+ (instancetype)exceptionWithCondition: (OFCondition*)condition; ++ (instancetype)exceptionWithCondition: (nullable OFCondition*)condition; /*! * @brief Initializes an already allocated condition wait failed exception. * * @param condition The condition for which could not be waited * @return An initialized condition wait failed exception */ -- initWithCondition: (OFCondition*)condition; +- initWithCondition: (nullable OFCondition*)condition; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFConditionWaitFailedException.m ================================================================== --- src/exceptions/OFConditionWaitFailedException.m +++ src/exceptions/OFConditionWaitFailedException.m @@ -26,15 +26,10 @@ + (instancetype)exceptionWithCondition: (OFCondition*)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } -- init -{ - OF_INVALID_INIT_METHOD -} - - initWithCondition: (OFCondition*)condition { self = [super init]; _condition = [condition retain]; @@ -49,9 +44,13 @@ [super dealloc]; } - (OFString*)description { - return [OFString stringWithFormat: - @"Waiting for a condition of type %@ failed!", [_condition class]]; + if (_condition != nil) + return [OFString stringWithFormat: + @"Waiting for a condition of type %@ failed!", + [_condition class]]; + else + return @"Waiting for a condition failed!"; } @end Index: src/exceptions/OFConnectionFailedException.h ================================================================== --- src/exceptions/OFConnectionFailedException.h +++ src/exceptions/OFConnectionFailedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFConnectionFailedException \ * OFConnectionFailedException.h ObjFW/OFConnectionFailedException.h * * @brief An exception indicating that a connection could not be established. @@ -104,5 +106,7 @@ - initWithHost: (OFString*)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFCopyItemFailedException.h ================================================================== --- src/exceptions/OFCopyItemFailedException.h +++ src/exceptions/OFCopyItemFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFCopyItemFailedException \ * OFCopyItemFailedException.h ObjFW/OFCopyItemFailedException.h * * @brief An exception indicating that copying a item failed. @@ -65,5 +67,7 @@ */ - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFCreateDirectoryFailedException.h ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.h +++ src/exceptions/OFCreateDirectoryFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFCreateDirectoryFailedException \ * OFCreateDirectoryFailedException.h \ * ObjFW/OFCreateDirectoryFailedException.h * @@ -59,5 +61,7 @@ * @return An initialized create directory failed exception */ - initWithPath: (OFString*)path errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFCreateSymbolicLinkFailedException.h ================================================================== --- src/exceptions/OFCreateSymbolicLinkFailedException.h +++ src/exceptions/OFCreateSymbolicLinkFailedException.h @@ -14,11 +14,12 @@ * file. */ #import "OFException.h" -#if defined(OF_HAVE_SYMLINK) || defined(OF_WINDOWS) +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFCreateSymbolicLinkFailedException \ * OFCreateSymbolicLinkFailedException.h \ * ObjFW/OFCreateSymbolicLinkFailedException.h * @@ -89,6 +90,7 @@ */ - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo; @end -#endif + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFCreateSymbolicLinkFailedException.m ================================================================== --- src/exceptions/OFCreateSymbolicLinkFailedException.m +++ src/exceptions/OFCreateSymbolicLinkFailedException.m @@ -17,11 +17,10 @@ #include "config.h" #import "OFCreateSymbolicLinkFailedException.h" #import "OFString.h" -#if defined(OF_HAVE_SYMLINK) || defined(OF_WINDOWS) @implementation OFCreateSymbolicLinkFailedException @synthesize sourcePath = _sourcePath, destinationPath = _destinationPath; @synthesize errNo = _errNo; + (instancetype)exceptionWithSourcePath: (OFString*)sourcePath @@ -98,6 +97,5 @@ return [OFString stringWithFormat: @"Failed to create symbolic link %@ with destination %@!", _destinationPath, _sourcePath]; } @end -#endif Index: src/exceptions/OFEnumerationMutationException.h ================================================================== --- src/exceptions/OFEnumerationMutationException.h +++ src/exceptions/OFEnumerationMutationException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFEnumerationMutationException \ * OFEnumerationMutationException.h \ * ObjFW/OFEnumerationMutationException.h * @@ -48,5 +50,7 @@ * @param object The object which was mutated during enumeration * @return An initialized enumeration mutation exception */ - initWithObject: (id)object; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFException.h ================================================================== --- src/exceptions/OFException.h +++ src/exceptions/OFException.h @@ -14,10 +14,12 @@ * file. */ #import "OFObject.h" +OF_ASSUME_NONNULL_BEGIN + @class OFString; #ifndef DOXYGEN @class OFArray OF_GENERIC(ObjectType); @class OFMutableArray OF_GENERIC(ObjectType); #endif @@ -164,15 +166,17 @@ * @brief Returns a backtrace of when the exception was created or nil if no * backtrace is available. * * @return A backtrace of when the exception was created */ -- (OFArray*)backtrace; +- (nullable OFArray*)backtrace; @end #ifdef __cplusplus extern "C" { #endif extern OFString* of_strerror(int errNo); #ifdef __cplusplus } #endif + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFGetOptionFailedException.h ================================================================== --- src/exceptions/OFGetOptionFailedException.h +++ src/exceptions/OFGetOptionFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + @class OFStream; /*! * @class OFGetOptionFailedException \ * OFGetOptionFailedException.h ObjFW/OFGetOptionFailedException.h @@ -58,5 +60,7 @@ * @return An initialized get option failed exception */ - initWithStream: (OFStream*)stream errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFHTTPRequestFailedException.h ================================================================== --- src/exceptions/OFHTTPRequestFailedException.h +++ src/exceptions/OFHTTPRequestFailedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif +OF_ASSUME_NONNULL_BEGIN + @class OFHTTPRequest; @class OFHTTPResponse; /*! * @class OFHTTPRequestFailedException \ @@ -64,5 +66,7 @@ * @return A new HTTP request failed exception */ - initWithRequest: (OFHTTPRequest*)request response: (OFHTTPResponse*)response; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFHashAlreadyCalculatedException.h ================================================================== --- src/exceptions/OFHashAlreadyCalculatedException.h +++ src/exceptions/OFHashAlreadyCalculatedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFHashAlreadyCalculatedException \ * OFHashAlreadyCalculatedException.h \ * ObjFW/OFHashAlreadyCalculatedException.h * @@ -47,5 +49,7 @@ * @param object The hash which has already been calculated * @return An initialized hash already calculated exception */ - initWithObject: (id)object; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFInitializationFailedException.h ================================================================== --- src/exceptions/OFInitializationFailedException.h +++ src/exceptions/OFInitializationFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFInitializationFailedException \ * OFInitializationFailedException.h \ * ObjFW/OFInitializationFailedException.h * @@ -29,23 +31,25 @@ } /*! * The class for which initialization failed. */ -@property (readonly, nonatomic) Class inClass; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) Class inClass; /*! * @brief Creates a new, autoreleased initialization failed exception. * * @param class_ The class for which initialization failed * @return A new, autoreleased initialization failed exception */ -+ (instancetype)exceptionWithClass: (Class)class_; ++ (instancetype)exceptionWithClass: (nullable Class)class_; /*! * @brief Initializes an already allocated initialization failed exception. * * @param class_ The class for which initialization failed * @return An initialized initialization failed exception */ -- initWithClass: (Class)class_; +- initWithClass: (nullable Class)class_; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFInitializationFailedException.m ================================================================== --- src/exceptions/OFInitializationFailedException.m +++ src/exceptions/OFInitializationFailedException.m @@ -25,15 +25,10 @@ + (instancetype)exceptionWithClass: (Class)class { return [[[self alloc] initWithClass: class] autorelease]; } -- init -{ - OF_INVALID_INIT_METHOD -} - - initWithClass: (Class)class { self = [super init]; _inClass = class; @@ -41,9 +36,12 @@ return self; } - (OFString*)description { - return [OFString stringWithFormat: - @"Initialization failed for or in class %@!", _inClass]; + if (_inClass != Nil) + return [OFString stringWithFormat: + @"Initialization failed for or in class %@!", _inClass]; + else + return @"Initialization failed!"; } @end Index: src/exceptions/OFInvalidArgumentException.h ================================================================== --- src/exceptions/OFInvalidArgumentException.h +++ src/exceptions/OFInvalidArgumentException.h @@ -14,13 +14,17 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFInvalidArgumentException \ * OFInvalidArgumentException.h ObjFW/OFInvalidArgumentException.h * * @brief An exception indicating that the argument is invalid for this method. */ @interface OFInvalidArgumentException: OFException @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFInvalidEncodingException.h ================================================================== --- src/exceptions/OFInvalidEncodingException.h +++ src/exceptions/OFInvalidEncodingException.h @@ -14,13 +14,17 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFInvalidEncodingException \ * OFInvalidEncodingException.h ObjFW/OFInvalidEncodingException.h * * @brief An exception indicating that the encoding is invalid for this object. */ @interface OFInvalidEncodingException: OFException @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFInvalidFormatException.h ================================================================== --- src/exceptions/OFInvalidFormatException.h +++ src/exceptions/OFInvalidFormatException.h @@ -14,13 +14,17 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFInvalidFormatException \ * OFInvalidFormatException.h ObjFW/OFInvalidFormatException.h * * @brief An exception indicating that the format is invalid. */ @interface OFInvalidFormatException: OFException @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFInvalidJSONException.h ================================================================== --- src/exceptions/OFInvalidJSONException.h +++ src/exceptions/OFInvalidJSONException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFInvalidJSONException \ * OFInvalidJSONException.h ObjFW/OFInvalidJSONException.h * * @brief An exception indicating a JSON representation is invalid. @@ -56,5 +58,7 @@ * @return An initialized invalid JSON exception */ - initWithString: (OFString*)string line: (size_t)line; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFInvalidServerReplyException.h ================================================================== --- src/exceptions/OFInvalidServerReplyException.h +++ src/exceptions/OFInvalidServerReplyException.h @@ -14,13 +14,17 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFInvalidServerReplyException \ * OFInvalidServerReplyException.h ObjFW/OFInvalidServerReplyException.h * * @brief An exception indicating that the server sent an invalid reply. */ @interface OFInvalidServerReplyException: OFException @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFLinkFailedException.h ================================================================== --- src/exceptions/OFLinkFailedException.h +++ src/exceptions/OFLinkFailedException.h @@ -14,11 +14,12 @@ * file. */ #import "OFException.h" -#if defined(OF_HAVE_LINK) || defined(OF_WINDOWS) +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFLinkFailedException \ * OFLinkFailedException.h ObjFW/OFLinkFailedException.h * * @brief An exception indicating that creating a link failed. @@ -86,6 +87,7 @@ */ - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo; @end -#endif + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFLinkFailedException.m ================================================================== --- src/exceptions/OFLinkFailedException.m +++ src/exceptions/OFLinkFailedException.m @@ -17,11 +17,10 @@ #include "config.h" #import "OFLinkFailedException.h" #import "OFString.h" -#if defined(OF_HAVE_LINK) || defined(OF_WINDOWS) @implementation OFLinkFailedException @synthesize sourcePath = _sourcePath, destinationPath = _destinationPath; @synthesize errNo = _errNo; + (instancetype)exceptionWithSourcePath: (OFString*)sourcePath @@ -97,6 +96,5 @@ return [OFString stringWithFormat: @"Failed to link file %@ to %@!", _sourcePath, _destinationPath]; } @end -#endif Index: src/exceptions/OFListenFailedException.h ================================================================== --- src/exceptions/OFListenFailedException.h +++ src/exceptions/OFListenFailedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFListenFailedException \ * OFListenFailedException.h ObjFW/OFListenFailedException.h * * @brief An exception indicating that listening on the socket failed. @@ -69,5 +71,7 @@ */ - initWithSocket: (id)socket backLog: (int)backLog errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFLockFailedException.h ================================================================== --- src/exceptions/OFLockFailedException.h +++ src/exceptions/OFLockFailedException.h @@ -15,10 +15,12 @@ */ #import "OFException.h" #import "OFLocking.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFLockFailedException \ * OFLockFailedException.h ObjFW/OFLockFailedException.h * * @brief An exception indicating that locking a lock failed. @@ -29,23 +31,25 @@ } /*! * The lock which could not be locked. */ -@property (readonly, nonatomic) id lock; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) id lock; /*! * @brief Creates a new, autoreleased lock failed exception. * * @param lock The lock which could not be locked * @return A new, autoreleased lock failed exception */ -+ (instancetype)exceptionWithLock: (id )lock; ++ (instancetype)exceptionWithLock: (nullable id )lock; /*! * @brief Initializes an already allocated lock failed exception. * * @param lock The lock which could not be locked * @return An initialized lock failed exception */ -- initWithLock: (id )lock; +- initWithLock: (nullable id )lock; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFMalformedXMLException.h ================================================================== --- src/exceptions/OFMalformedXMLException.h +++ src/exceptions/OFMalformedXMLException.h @@ -16,10 +16,12 @@ #import "OFException.h" @class OFXMLParser; +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFMalformedXMLException \ * OFMalformedXMLException.h ObjFW/OFMalformedXMLException.h * * @brief An exception indicating that a parser encountered malformed XML. @@ -30,23 +32,25 @@ } /*! * The parser which encountered malformed XML. */ -@property (readonly, nonatomic) OFXMLParser *parser; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFXMLParser *parser; /*! * @brief Creates a new, autoreleased malformed XML exception. * * @param parser The parser which encountered malformed XML * @return A new, autoreleased malformed XML exception */ -+ (instancetype)exceptionWithParser: (OFXMLParser*)parser; ++ (instancetype)exceptionWithParser: (nullable OFXMLParser*)parser; /*! * @brief Initializes an already allocated malformed XML exception. * * @param parser The parser which encountered malformed XML * @return An initialized malformed XML exception */ -- initWithParser: (OFXMLParser*)parser; +- initWithParser: (nullable OFXMLParser*)parser; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFMemoryNotPartOfObjectException.h ================================================================== --- src/exceptions/OFMemoryNotPartOfObjectException.h +++ src/exceptions/OFMemoryNotPartOfObjectException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFMemoryNotPartOfObjectException \ * OFMemoryNotPartOfObjectException.h \ * ObjFW/OFMemoryNotPartOfObjectException.h * @@ -57,5 +59,7 @@ * @return An initialized memory not part of object exception */ - initWithPointer: (void*)pointer object: (id)object; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFMoveItemFailedException.h ================================================================== --- src/exceptions/OFMoveItemFailedException.h +++ src/exceptions/OFMoveItemFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFMoveItemFailedException \ * OFMoveItemFailedException.h ObjFW/OFMoveItemFailedException.h * * @brief An exception indicating that moving an item failed. @@ -65,5 +67,7 @@ */ - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFNotImplementedException.h ================================================================== --- src/exceptions/OFNotImplementedException.h +++ src/exceptions/OFNotImplementedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFNotImplementedException \ * OFNotImplementedException.h ObjFW/OFNotImplementedException.h * * @brief An exception indicating that a method or part of it is not @@ -57,5 +59,7 @@ * @return An initialized not implemented exception */ - initWithSelector: (SEL)selector object: (id)object; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFNotOpenException.h ================================================================== --- src/exceptions/OFNotOpenException.h +++ src/exceptions/OFNotOpenException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFNotOpenException OFNotOpenException.h ObjFW/OFNotOpenException.h * * @brief An exception indicating an object is not open, connected or bound. */ @@ -45,5 +47,7 @@ * @param object The object which is not open, connected or bound * @return An initialized not open exception */ - initWithObject: (id)object; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFObserveFailedException.h ================================================================== --- src/exceptions/OFObserveFailedException.h +++ src/exceptions/OFObserveFailedException.h @@ -13,10 +13,12 @@ * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" + +OF_ASSUME_NONNULL_BEGIN @class OFKernelEventObserver; /*! * @class OFObserveFailedException \ @@ -58,5 +60,7 @@ * @return An initialized observe failed exception */ - initWithObserver: (OFKernelEventObserver*)observer errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFOpenItemFailedException.h ================================================================== --- src/exceptions/OFOpenItemFailedException.h +++ src/exceptions/OFOpenItemFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFOpenItemFailedException \ * OFOpenItemFailedException.h ObjFW/OFOpenItemFailedException.h * * @brief An exception indicating an item could not be opened. @@ -34,11 +36,11 @@ @property (readonly, nonatomic) OFString *path; /*! * The mode in which the item should have been opened. */ -@property (readonly, nonatomic) OFString *mode; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *mode; /*! * The errno of the error that occurred. */ @property (readonly) int errNo; @@ -57,11 +59,11 @@ * @param path A string with the path of the item tried to open * @param mode A string with the mode in which the item should have been opened * @return A new, autoreleased open item failed exception */ + (instancetype)exceptionWithPath: (OFString*)path - mode: (OFString*)mode; + mode: (nullable OFString*)mode; /*! * @brief Creates a new, autoreleased open item failed exception. * * @param path A string with the path of the item tried to open @@ -78,11 +80,11 @@ * @param mode A string with the mode in which the item should have been opened * @param errNo The errno of the error that occurred * @return A new, autoreleased open item failed exception */ + (instancetype)exceptionWithPath: (OFString*)path - mode: (OFString*)mode + mode: (nullable OFString*)mode errNo: (int)errNo; /*! * @brief Initializes an already allocated open item failed exception. * @@ -97,11 +99,11 @@ * @param path A string with the path of the item which could not be opened * @param mode A string with the mode in which the item should have been opened * @return An initialized open item failed exception */ - initWithPath: (OFString*)path - mode: (OFString*)mode; + mode: (nullable OFString*)mode; /*! * @brief Initializes an already allocated open item failed exception. * * @param path A string with the path of the item which could not be opened @@ -118,8 +120,10 @@ * @param mode A string with the mode in which the item should have been opened * @param errNo The errno of the error that occurred * @return An initialized open item failed exception */ - initWithPath: (OFString*)path - mode: (OFString*)mode + mode: (nullable OFString*)mode errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFOutOfMemoryException.h ================================================================== --- src/exceptions/OFOutOfMemoryException.h +++ src/exceptions/OFOutOfMemoryException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFOutOfMemoryException \ * OFOutOfMemoryException.h ObjFW/OFOutOfMemoryException.h * * @brief An exception indicating there is not enough memory available. @@ -46,5 +48,7 @@ * @param requestedSize The size of the memory that could not be allocated * @return An initialized no memory exception */ - initWithRequestedSize: (size_t)requestedSize; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFOutOfRangeException.h ================================================================== --- src/exceptions/OFOutOfRangeException.h +++ src/exceptions/OFOutOfRangeException.h @@ -14,13 +14,17 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFOutOfRangeException \ * OFOutOfRangeException.h ObjFW/OFOutOfRangeException.h * * @brief An exception indicating the given value is out of range. */ @interface OFOutOfRangeException: OFException @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFReadFailedException.h ================================================================== --- src/exceptions/OFReadFailedException.h +++ src/exceptions/OFReadFailedException.h @@ -14,13 +14,17 @@ * file. */ #import "OFReadOrWriteFailedException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFReadFailedException \ * OFReadFailedException.h ObjFW/OFReadFailedException.h * * @brief An exception indicating that reading from an object failed. */ @interface OFReadFailedException: OFReadOrWriteFailedException @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFReadOrWriteFailedException.h ================================================================== --- src/exceptions/OFReadOrWriteFailedException.h +++ src/exceptions/OFReadOrWriteFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFReadOrWriteFailedException \ * OFReadOrWriteFailedException.h ObjFW/OFReadOrWriteFailedException.h * * @brief An exception indicating that reading from or writing to an object @@ -91,5 +93,7 @@ */ - initWithObject: (id)object requestedLength: (size_t)requestedLength errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFRemoveItemFailedException.h ================================================================== --- src/exceptions/OFRemoveItemFailedException.h +++ src/exceptions/OFRemoveItemFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFRemoveItemFailedException \ * OFRemoveItemFailedException.h ObjFW/OFRemoveItemFailedException.h * * @brief An exception indicating that removing an item failed. @@ -56,5 +58,7 @@ * @return An initialized remove item failed exception */ - initWithPath: (OFString*)path errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFSandboxActivationFailedException.h ================================================================== --- src/exceptions/OFSandboxActivationFailedException.h +++ src/exceptions/OFSandboxActivationFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + @class OFSandbox; /*! * @class OFSandboxActivationFailedException \ * OFSandboxActivationFailedException.h \ @@ -59,5 +61,7 @@ * @return An initialized sandboxing failed exception */ - initWithSandbox: (OFSandbox*)sandbox errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFSeekFailedException.h ================================================================== --- src/exceptions/OFSeekFailedException.h +++ src/exceptions/OFSeekFailedException.h @@ -15,10 +15,12 @@ */ #import "OFException.h" #import "OFSeekableStream.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFSeekFailedException \ * OFSeekFailedException.h ObjFW/OFSeekFailedException.h * * @brief An exception indicating that seeking in a stream failed. @@ -76,5 +78,7 @@ - initWithStream: (OFSeekableStream*)stream offset: (of_offset_t)offset whence: (int)whence errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFSetOptionFailedException.h ================================================================== --- src/exceptions/OFSetOptionFailedException.h +++ src/exceptions/OFSetOptionFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + @class OFStream; /*! * @class OFSetOptionFailedException \ * OFSetOptionFailedException.h ObjFW/OFSetOptionFailedException.h @@ -58,5 +60,7 @@ * @return An initialized set option failed exception */ - initWithStream: (OFStream*)stream errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFStatItemFailedException.h ================================================================== --- src/exceptions/OFStatItemFailedException.h +++ src/exceptions/OFStatItemFailedException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFStatItemFailedException \ * OFStatItemFailedException.h ObjFW/OFStatItemFailedException.h * * @brief An exception indicating an item's status could not be retrieved. @@ -76,5 +78,7 @@ * @return An initialized stat item failed exception */ - initWithPath: (OFString*)path errNo: (int)errNo; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFStillLockedException.h ================================================================== --- src/exceptions/OFStillLockedException.h +++ src/exceptions/OFStillLockedException.h @@ -15,10 +15,12 @@ */ #import "OFException.h" #import "OFLocking.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFStillLockedException \ * OFStillLockedException.h ObjFW/OFStillLockedException.h * * @brief An exception indicating that a lock is still locked. @@ -29,23 +31,25 @@ } /*! * The lock which is still locked. */ -@property (readonly, nonatomic) id lock; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) id lock; /*! * @brief Creates a new, autoreleased still locked exception. * * @param lock The lock which is still locked * @return A new, autoreleased still locked exception */ -+ (instancetype)exceptionWithLock: (id )lock; ++ (instancetype)exceptionWithLock: (nullable id )lock; /*! * @brief Initializes an already allocated still locked exception. * * @param lock The lock which is still locked * @return An initialized still locked exception */ -- initWithLock: (id )lock; +- initWithLock: (nullable id )lock; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFThreadJoinFailedException.h ================================================================== --- src/exceptions/OFThreadJoinFailedException.h +++ src/exceptions/OFThreadJoinFailedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_THREADS # error No threads available! #endif +OF_ASSUME_NONNULL_BEGIN + @class OFThread; /*! * @class OFThreadJoinFailedException \ * OFThreadJoinFailedException.h ObjFW/OFThreadJoinFailedException.h @@ -34,23 +36,25 @@ } /*! * The thread which could not be joined. */ -@property (readonly, nonatomic) OFThread *thread; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFThread *thread; /*! * @brief Creates a new, autoreleased thread join failed exception. * * @param thread The thread which could not be joined * @return A new, autoreleased thread join failed exception */ -+ (instancetype)exceptionWithThread: (OFThread*)thread; ++ (instancetype)exceptionWithThread: (nullable OFThread*)thread; /*! * @brief Initializes an already allocated thread join failed exception. * * @param thread The thread which could not be joined * @return An initialized thread join failed exception */ -- initWithThread: (OFThread*)thread; +- initWithThread: (nullable OFThread*)thread; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFThreadJoinFailedException.m ================================================================== --- src/exceptions/OFThreadJoinFailedException.m +++ src/exceptions/OFThreadJoinFailedException.m @@ -26,15 +26,10 @@ + (instancetype)exceptionWithThread: (OFThread*)thread { return [[[self alloc] initWithThread: thread] autorelease]; } -- init -{ - OF_INVALID_INIT_METHOD -} - - initWithThread: (OFThread*)thread { self = [super init]; _thread = [thread retain]; @@ -49,10 +44,15 @@ [super dealloc]; } - (OFString*)description { - return [OFString stringWithFormat: - @"Joining a thread of type %@ failed! Most likely, another thread " - @"already waits for the thread to join.", [_thread class]]; + if (_thread != nil) + return [OFString stringWithFormat: + @"Joining a thread of type %@ failed! Most likely, another " + @"thread already waits for the thread to join.", + [_thread class]]; + else + return @"Joining a thread failed! Most likely, another thread " + @"already waits for the thread to join."; } @end Index: src/exceptions/OFThreadStartFailedException.h ================================================================== --- src/exceptions/OFThreadStartFailedException.h +++ src/exceptions/OFThreadStartFailedException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_THREADS # error No threads available! #endif +OF_ASSUME_NONNULL_BEGIN + @class OFThread; /*! * @class OFThreadStartFailedException \ * OFThreadStartFailedException.h ObjFW/OFThreadStartFailedException.h @@ -34,23 +36,25 @@ } /*! * The thread which could not be started. */ -@property (readonly, nonatomic) OFThread *thread; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFThread *thread; /*! * @brief Creates a new, autoreleased thread start failed exception. * * @param thread The thread which could not be started * @return A new, autoreleased thread start failed exception */ -+ (instancetype)exceptionWithThread: (OFThread*)thread; ++ (instancetype)exceptionWithThread: (nullable OFThread*)thread; /*! * @brief Initializes an already allocated thread start failed exception. * * @param thread The thread which could not be started * @return An initialized thread start failed exception */ -- initWithThread: (OFThread*)thread; +- initWithThread: (nullable OFThread*)thread; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFThreadStartFailedException.m ================================================================== --- src/exceptions/OFThreadStartFailedException.m +++ src/exceptions/OFThreadStartFailedException.m @@ -26,15 +26,10 @@ + (instancetype)exceptionWithThread: (OFThread*)thread { return [[[self alloc] initWithThread: thread] autorelease]; } -- init -{ - OF_INVALID_INIT_METHOD -} - - initWithThread: (OFThread*)thread { self = [super init]; _thread = [thread retain]; @@ -49,9 +44,12 @@ [super dealloc]; } - (OFString*)description { - return [OFString stringWithFormat: - @"Starting a thread of type %@ failed!", [_thread class]]; + if (_thread != nil) + return [OFString stringWithFormat: + @"Starting a thread of type %@ failed!", [_thread class]]; + else + return @"Starting a thread failed!"; } @end Index: src/exceptions/OFThreadStillRunningException.h ================================================================== --- src/exceptions/OFThreadStillRunningException.h +++ src/exceptions/OFThreadStillRunningException.h @@ -18,10 +18,12 @@ #ifndef OF_HAVE_THREADS # error No threads available! #endif +OF_ASSUME_NONNULL_BEGIN + @class OFThread; /*! * @class OFThreadStillRunningException \ * OFThreadStillRunningException.h ObjFW/OFThreadStillRunningException.h @@ -34,23 +36,25 @@ } /*! * The thread which is still running. */ -@property (readonly, retain) OFThread *thread; +@property OF_NULLABLE_PROPERTY (readonly, retain) OFThread *thread; /*! * @brief Creates a new, autoreleased thread still running exception. * * @param thread The thread which is still running * @return A new, autoreleased thread still running exception */ -+ (instancetype)exceptionWithThread: (OFThread*)thread; ++ (instancetype)exceptionWithThread: (nullable OFThread*)thread; /*! * @brief Initializes an already allocated thread still running exception. * * @param thread The thread which is still running * @return An initialized thread still running exception */ -- initWithThread: (OFThread*)thread; +- initWithThread: (nullable OFThread*)thread; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFThreadStillRunningException.m ================================================================== --- src/exceptions/OFThreadStillRunningException.m +++ src/exceptions/OFThreadStillRunningException.m @@ -26,15 +26,10 @@ + (instancetype)exceptionWithThread: (OFThread*)thread { return [[[self alloc] initWithThread: thread] autorelease]; } -- init -{ - OF_INVALID_INIT_METHOD -} - - initWithThread: (OFThread*)thread { self = [super init]; _thread = [thread retain]; @@ -49,10 +44,15 @@ [super dealloc]; } - (OFString*)description { - return [OFString stringWithFormat: - @"Deallocation of a thread of type %@ was tried, even though it " - @"was still running!", [_thread class]]; + if (_thread) + return [OFString stringWithFormat: + @"Deallocation of a thread of type %@ was tried, even " + @"though it was still running!", + [_thread class]]; + else + return @"Deallocation of a thread was tried, even though it " + @"was still running!"; } @end Index: src/exceptions/OFTruncatedDataException.h ================================================================== --- src/exceptions/OFTruncatedDataException.h +++ src/exceptions/OFTruncatedDataException.h @@ -14,14 +14,18 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFTruncatedDataException \ * OFTruncatedDataException.h ObjFW/OFTruncatedDataException.h * * @brief An exception indicating that data was truncated while it should not * have been truncated. */ @interface OFTruncatedDataException: OFException @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnboundNamespaceException.h ================================================================== --- src/exceptions/OFUnboundNamespaceException.h +++ src/exceptions/OFUnboundNamespaceException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + @class OFXMLElement; /*! * @class OFUnboundNamespaceException \ * OFUnboundNamespaceException.h ObjFW/OFUnboundNamespaceException.h @@ -62,5 +64,7 @@ * @return An initialized unbound namespace exception */ - initWithNamespace: (OFString*)namespace_ element: (OFXMLElement*)element; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnboundPrefixException.h ================================================================== --- src/exceptions/OFUnboundPrefixException.h +++ src/exceptions/OFUnboundPrefixException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + @class OFXMLParser; /*! * @class OFUnboundPrefixException \ * OFUnboundPrefixException.h ObjFW/OFUnboundPrefixException.h @@ -58,5 +60,7 @@ * @return An initialized unbound prefix exception */ - initWithPrefix: (OFString*)prefix parser: (OFXMLParser*)parser; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFUndefinedKeyException.h ================================================================== --- src/exceptions/OFUndefinedKeyException.h +++ src/exceptions/OFUndefinedKeyException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFUndefinedKeyException \ * OFUndefinedKeyException.h ObjFW/OFUndefinedKeyException.h * * @brief An exception indicating that a key for Key Value Coding is undefined. @@ -90,5 +92,7 @@ */ - initWithObject: (id)object key: (OFString*)key value: (id)value; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnknownXMLEntityException.h ================================================================== --- src/exceptions/OFUnknownXMLEntityException.h +++ src/exceptions/OFUnknownXMLEntityException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFUnknownXMLEntityException \ * OFUnknownXMLEntityException.h ObjFW/OFUnknownXMLEntityException.h * * @brief An exception indicating that a parser encountered an unknown XML @@ -47,5 +49,7 @@ * @param entityName The name of the unknown XML entity * @return An initialized unknown XML entity exception */ - initWithEntityName: (OFString*)entityName; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnlockFailedException.h ================================================================== --- src/exceptions/OFUnlockFailedException.h +++ src/exceptions/OFUnlockFailedException.h @@ -15,10 +15,12 @@ */ #import "OFException.h" #import "OFLocking.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFUnlockFailedException \ * OFUnlockFailedException.h ObjFW/OFUnlockFailedException.h * * @brief An exception indicating that unlocking a lock failed. @@ -29,23 +31,25 @@ } /*! * The lock which could not be unlocked. */ -@property (readonly, nonatomic) id lock; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) id lock; /*! * @brief Creates a new, autoreleased unlock failed exception. * * @param lock The lock which could not be unlocked * @return A new, autoreleased unlock failed exception */ -+ (instancetype)exceptionWithLock: (id )lock; ++ (instancetype)exceptionWithLock: (nullable id )lock; /*! * @brief Initializes an already allocated unlock failed exception. * * @param lock The lock which could not be unlocked * @return An initialized unlock failed exception */ -- initWithLock: (id )lock; +- initWithLock: (nullable id )lock; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnsupportedProtocolException.h ================================================================== --- src/exceptions/OFUnsupportedProtocolException.h +++ src/exceptions/OFUnsupportedProtocolException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + @class OFURL; /*! * @class OFUnsupportedProtocolException \ * OFUnsupportedProtocolException.h \ @@ -50,5 +52,7 @@ * @param URL The URL whose protocol is unsupported * @return An initialized unsupported protocol exception */ - initWithURL: (OFURL*)URL; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnsupportedVersionException.h ================================================================== --- src/exceptions/OFUnsupportedVersionException.h +++ src/exceptions/OFUnsupportedVersionException.h @@ -14,10 +14,12 @@ * file. */ #import "OFException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFUnsupportedVersionException \ * OFUnsupportedVersionException.h ObjFW/OFUnsupportedVersionException.h * * @brief An exception indicating that the specified version of the format or @@ -47,5 +49,7 @@ * @param version The version which is unsupported * @return An initialized unsupported version exception */ - initWithVersion: (OFString*)version; @end + +OF_ASSUME_NONNULL_END Index: src/exceptions/OFWriteFailedException.h ================================================================== --- src/exceptions/OFWriteFailedException.h +++ src/exceptions/OFWriteFailedException.h @@ -14,13 +14,17 @@ * file. */ #import "OFReadOrWriteFailedException.h" +OF_ASSUME_NONNULL_BEGIN + /*! * @class OFWriteFailedException \ * OFWriteFailedException.h ObjFW/OFWriteFailedException.h * * @brief An exception indicating that writing to an object failed. */ @interface OFWriteFailedException: OFReadOrWriteFailedException @end + +OF_ASSUME_NONNULL_END