Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -153,11 +153,10 @@ /** * @brief Creates a new OFArray with the specified object. * * @param object An object * @return A new autoreleased OFArray - * @throw OFInvalidArgumentException The provided object was `nil` */ + (instancetype)arrayWithObject: (ObjectType)object; /** * @brief Creates a new OFArray with the specified objects, terminated by `nil`. @@ -189,11 +188,10 @@ /** * @brief Initializes an OFArray with the specified object. * * @param object An object * @return An initialized OFArray - * @throw OFInvalidArgumentException The provided object was `nil` */ - (instancetype)initWithObject: (ObjectType)object; /** * @brief Initializes an OFArray with the specified objects. @@ -281,11 +279,10 @@ /** * @brief Copies the objects at the specified range to the specified buffer. * * @param buffer The buffer to copy the objects to * @param range The range to copy - * @throw OFOutOfRangeException The provided range is out of bounds */ - (void)getObjects: (ObjectType __unsafe_unretained _Nonnull *_Nonnull)buffer inRange: (OFRange)range; /** @@ -330,30 +327,27 @@ /** * @brief Returns the objects in the specified range as a new OFArray. * * @param range The range for the subarray * @return The subarray as a new autoreleased OFArray - * @throw OFOutOfRangeException The provided range is out of bounds */ - (OFArray OF_GENERIC(ObjectType) *)objectsInRange: (OFRange)range; /** * @brief Creates a string by joining all objects of the array. * * @param separator The string with which the objects should be joined * @return A string containing all objects joined by the separator - * @throw OFInvalidArgumentException The provided separator was `nil` */ - (OFString *)componentsJoinedByString: (OFString *)separator; /** * @brief Creates a string by joining all objects of the array. * * @param separator The string with which the objects should be joined * @param options Options according to which the objects should be joined * @return A string containing all objects joined by the separator - * @throw OFInvalidArgumentException The provided separator was `nil` */ - (OFString *)componentsJoinedByString: (OFString *)separator options: (OFArrayJoinOptions)options; /** @@ -361,12 +355,10 @@ * and joining the strings returned by calling the selector. * * @param separator The string with which the objects should be joined * @param selector The selector to perform on the objects * @return A string containing all objects joined by the separator - * @throw OFInvalidArgumentException The provided separator was `nil` or calling - * the provided selector returned `nil` */ - (OFString *)componentsJoinedByString: (OFString *)separator usingSelector: (SEL)selector; /** @@ -375,12 +367,10 @@ * * @param separator The string with which the objects should be joined * @param selector The selector to perform on the objects * @param options Options according to which the objects should be joined * @return A string containing all objects joined by the separator - * @throw OFInvalidArgumentException The provided separator was `nil` or calling - * the provided selector returned `nil` */ - (OFString *)componentsJoinedByString: (OFString *)separator usingSelector: (SEL)selector options: (OFArrayJoinOptions)options; @@ -432,20 +422,18 @@ /** * @brief Creates a new array with the specified object added. * * @param object The object to add * @return A new array with the specified object added - * @throw OFInvalidArgumentException The specified object was `nil` */ - (OFArray OF_GENERIC(ObjectType) *)arrayByAddingObject: (ObjectType)object; /** * @brief Creates a new array with the objects from the specified array added. * * @param array The array with objects to add * @return A new array with the objects from the specified array added - * @throw OFInvalidArgumentException The specified array was `nil` */ - (OFArray OF_GENERIC(ObjectType) *)arrayByAddingObjectsFromArray: (OFArray OF_GENERIC(ObjectType) *)array; #ifdef OF_HAVE_BLOCKS Index: src/OFColor.h ================================================================== --- src/OFColor.h +++ src/OFColor.h @@ -54,11 +54,10 @@ * @param red The red value of the color, between 0.0 and 1.0 * @param green The green value of the color, between 0.0 and 1.0 * @param blue The blue value of the color, between 0.0 and 1.0 * @param alpha The alpha value of the color, between 0.0 and 1.0 * @return A new color with the specified red, green, blue and alpha value - * @throw OFInvalidArgumentException One of the specified arguments is invalid */ + (instancetype)colorWithRed: (float)red green: (float)green blue: (float)blue alpha: (float)alpha; @@ -215,11 +214,10 @@ * @param green The green value of the color, between 0.0 and 1.0 * @param blue The blue value of the color, between 0.0 and 1.0 * @param alpha The alpha value of the color, between 0.0 and 1.0 * @return A color initialized with the specified red, green, blue and alpha * value - * @throw OFInvalidArgumentException One of the specified arguments is invalid */ - (instancetype)initWithRed: (float)red green: (float)green blue: (float)blue alpha: (float)alpha; Index: src/OFDNSResourceRecord.h ================================================================== --- src/OFDNSResourceRecord.h +++ src/OFDNSResourceRecord.h @@ -639,23 +639,22 @@ /** * @brief Parses the specified string as an @ref OFDNSClass. * * @param string The string to parse as an @ref OFDNSClass * @return The parsed OFDNSClass - * @throw OFInvalidArgumentException The specified string is not valid DNS class + * @throw OFInvalidFormatException The specified string is not valid DNS class */ extern OFDNSClass OFDNSClassParseName(OFString *_Nonnull string); /** * @brief Parses the specified string as an @ref OFDNSRecordType. * * @param string The string to parse as an @ref OFDNSRecordType * @return The parsed OFDNSRecordType - * @throw OFInvalidArgumentException The specified string is not valid record - * type + * @throw OFInvalidFormatException The specified string is not valid DNS class */ extern OFDNSRecordType OFDNSRecordTypeParseName(OFString *_Nonnull string); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END Index: src/OFDNSResourceRecord.m ================================================================== --- src/OFDNSResourceRecord.m +++ src/OFDNSResourceRecord.m @@ -17,11 +17,10 @@ #import "OFDNSResourceRecord.h" #import "OFArray.h" #import "OFData.h" -#import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" OFString * OFDNSClassName(OFDNSClass DNSClass) { @@ -77,16 +76,12 @@ string = string.uppercaseString; if ([string isEqual: @"IN"]) DNSClass = OFDNSClassIN; else { - @try { - DNSClass = (OFDNSClass) - [string unsignedLongLongValueWithBase: 0]; - } @catch (OFInvalidFormatException *e) { - @throw [OFInvalidArgumentException exception]; - } + DNSClass = + (OFDNSClass)[string unsignedLongLongValueWithBase: 0]; } objc_autoreleasePoolPop(pool); return DNSClass; @@ -123,16 +118,12 @@ else if ([string isEqual: @"SRV"]) recordType = OFDNSRecordTypeSRV; else if ([string isEqual: @"ALL"]) recordType = OFDNSRecordTypeAll; else { - @try { - recordType = (OFDNSRecordType) - [string unsignedLongLongValueWithBase: 0]; - } @catch (OFInvalidFormatException *e) { - @throw [OFInvalidArgumentException exception]; - } + recordType = + (OFDNSRecordType)[string unsignedLongLongValueWithBase: 0]; } objc_autoreleasePoolPop(pool); return recordType; Index: src/OFData+MessagePackParsing.h ================================================================== --- src/OFData+MessagePackParsing.h +++ src/OFData+MessagePackParsing.h @@ -32,11 +32,10 @@ * * @throw OFInvalidFormatException The MessagePack representation contained in * the data contained an invalid format * @throw OFTruncatedDataException The MessagePack representation contained in * the data is truncated - * @throw OFInvalidArgumentException The @ref itemSize of the data is not 1 * @throw OFOutOfRangeException The depth limit has been exceeded */ @property (readonly, nonatomic) id objectByParsingMessagePack; /** @@ -47,12 +46,11 @@ * @return The MessagePack representation as an object * @throw OFInvalidFormatException The MessagePack representation contained in * the data contained an invalid format * @throw OFTruncatedDataException The MessagePack representation contained in * the data is truncated - * @throw OFInvalidArgumentException The @ref itemSize of the data is not 1 * @throw OFOutOfRangeException The depth limit has been exceeded */ - (id)objectByParsingMessagePackWithDepthLimit: (size_t)depthLimit; @end OF_ASSUME_NONNULL_END Index: src/OFData.h ================================================================== --- src/OFData.h +++ src/OFData.h @@ -277,10 +277,12 @@ * @brief Initializes an already allocated OFData with an item size of 1, * containing the data of the hex string representation. * * @param string The hex string representation of the data * @return A new autoreleased OFData + * @throw OFInvalidFormatException The specified string is not correctly + * formatted */ - (instancetype)initWithStringRepresentation: (OFString *)string; /** * @brief Initializes an already allocated OFData with an item size of 1, Index: src/OFData.m ================================================================== --- src/OFData.m +++ src/OFData.m @@ -33,10 +33,11 @@ #import "OFURLHandler.h" #import "OFXMLElement.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" +#import "OFNotImplementedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" #import "OFUnsupportedProtocolException.h" @@ -603,11 +604,12 @@ { void *pool; OFXMLElement *element; if (_itemSize != 1) - @throw [OFInvalidArgumentException exception]; + @throw [OFNotImplementedException exceptionWithSelector: _cmd + object: self]; pool = objc_autoreleasePoolPush(); element = [OFXMLElement elementWithName: self.className namespace: OFSerializationNS @@ -623,11 +625,12 @@ - (OFData *)messagePackRepresentation { OFMutableData *data; if (_itemSize != 1) - @throw [OFInvalidArgumentException exception]; + @throw [OFNotImplementedException exceptionWithSelector: _cmd + object: self]; if (_count <= UINT8_MAX) { uint8_t type = 0xC4; uint8_t tmp = (uint8_t)_count; Index: src/OFMessagePackRepresentation.h ================================================================== --- src/OFMessagePackRepresentation.h +++ src/OFMessagePackRepresentation.h @@ -27,13 +27,10 @@ * MessagePack representation. */ @protocol OFMessagePackRepresentation /** * @brief The MessagePack representation of the object as OFData. - * - * @throw OFOutOfRangeException The object is too big for a MessagePack - * representation */ @property (readonly, nonatomic) OFData *messagePackRepresentation; @end OF_ASSUME_NONNULL_END Index: src/OFMutableSet.h ================================================================== --- src/OFMutableSet.h +++ src/OFMutableSet.h @@ -49,19 +49,17 @@ /** * @brief Adds the specified object to the set. * * @param object The object to add to the set - * @throw OFInvalidArgumentException The specified object was `nil` */ - (void)addObject: (ObjectType)object; /** * @brief Removes the specified object from the set. * * @param object The object to remove from the set - * @throw OFInvalidArgumentException The specified object was `nil` */ - (void)removeObject: (ObjectType)object; /** * @brief Removes all objects from the receiver which are in the specified set. Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -748,11 +748,10 @@ * @brief Replaces a class method with a class method from another class. * * @param selector The selector of the class method to replace * @param class_ The class from which the new class method should be taken * @return The old implementation - * @throw OFInvalidArgumentException A specified argument is invalid */ + (nullable IMP)replaceClassMethod: (SEL)selector withMethodFromClass: (Class)class_; /** @@ -760,11 +759,10 @@ * class. * * @param selector The selector of the instance method to replace * @param class_ The class from which the new instance method should be taken * @return The old implementation - * @throw OFInvalidArgumentException A specified argument is invalid */ + (nullable IMP)replaceInstanceMethod: (SEL)selector withMethodFromClass: (Class)class_; /** @@ -1300,11 +1298,12 @@ * @param count The number of items to allocate * @param size The size of each item to allocate * @return A pointer to the allocated memory. May return NULL if the specified * size or count is 0. * @throw OFOutOfMemoryException The allocation failed due to not enough memory - * @throw OFOutOfRangeException The requested size exceeds the address space + * @throw OFOutOfRangeException The requested `count * size` exceeds the + * address space */ extern void *_Nullable OFAllocMemory(size_t count, size_t size) OF_WARN_UNUSED_RESULT; /** @@ -1316,11 +1315,12 @@ * @param size The size of each item to allocate * @param count The number of items to allocate * @return A pointer to the allocated memory. May return NULL if the specified * size or count is 0. * @throw OFOutOfMemoryException The allocation failed due to not enough memory - * @throw OFOutOfRangeException The requested size exceeds the address space + * @throw OFOutOfRangeException The requested `count * size` exceeds the + * address space */ extern void *_Nullable OFAllocZeroedMemory(size_t count, size_t size) OF_WARN_UNUSED_RESULT; /** @@ -1335,11 +1335,12 @@ * @param size The size of each item to resize to * @param count The number of items to resize to * @return A pointer to the resized memory chunk * @throw OFOutOfMemoryException The reallocation failed due to not enough * memory - * @throw OFOutOfRangeException The requested size exceeds the address space + * @throw OFOutOfRangeException The requested `count * size` exceeds the + * address space */ extern void *_Nullable OFResizeMemory(void *_Nullable pointer, size_t count, size_t size) OF_WARN_UNUSED_RESULT; /** Index: src/OFSerialization.h ================================================================== --- src/OFSerialization.h +++ src/OFSerialization.h @@ -34,16 +34,12 @@ /** * @brief Initializes the object with the specified XML element serialization. * * @param element An OFXMLElement with the serialized object * @return An initialized object - * @throw OFInvalidArgumentException The specified element is not valid - * serialization * @throw OFInvalidFormatException The specified element is not of the correct * serialization format - * @throw OFOutOfRangeException The specified element is too big for - * deserialization */ - (instancetype)initWithSerialization: (OFXMLElement *)element; @end #ifdef __cplusplus Index: src/OFValue.h ================================================================== --- src/OFValue.h +++ src/OFValue.h @@ -33,46 +33,46 @@ @property (readonly, nonatomic) const char *objCType; /** * @brief The value as a pointer to void. * - * If the value is not pointer-sized, @ref OFOutOfRangeException is thrown. + * @throw OFOutOfRangeException The value is not pointer-sized */ @property (readonly, nonatomic) void *pointerValue; /** * @brief The value as a non-retained object. * - * If the value is not pointer-sized, @ref OFOutOfRangeException is thrown. + * @throw OFOutOfRangeException The value is not pointer-sized */ @property (readonly, nonatomic) id nonretainedObjectValue; /** * @brief The value as an OFRange. * - * If the value is not OFRange-sized, @ref OFOutOfRangeException is thrown. + * @throw OFOutOfRangeException The value is not OFRange-sized */ @property (readonly, nonatomic) OFRange rangeValue; /** * @brief The value as an OFPoint. * - * If the value is not OFPoint-sized, @ref OFOutOfRangeException is thrown. + * @throw OFOutOfRangeException The value is not OFPoint-sized */ @property (readonly, nonatomic) OFPoint pointValue; /** * @brief The value as an OFSize. * - * If the value is not OFSize-sized, @ref OFOutOfRangeException is thrown. + * @throw OFOutOfRangeException The value is not OFSize-sized */ @property (readonly, nonatomic) OFSize sizeValue; /** * @brief The value as a OFRect. * - * If the value is not OFRect-sized, @ref OFOutOfRangeException is thrown. + * @throw OFOutOfRangeException The value is not OFRect-sized */ @property (readonly, nonatomic) OFRect rectValue; /** * @brief Creates a new, autorelease OFValue with the specified bytes of the @@ -152,13 +152,10 @@ objCType: (const char *)objCType; /** * @brief Gets the value. * - * If the specified size does not match, this raises an - * @ref OFOutOfRangeException. - * * @param value The buffer to copy the value into * @param size The size of the value * @throw OFOutOfRangeException The specified size does not match the value */ - (void)getValue: (void *)value size: (size_t)size;