Lack of force-unwrap operator in Obj-C makes nullability warnings very hard to deal with

Originator:jtbandes
Number:rdar://21374277 Date Originated:6/13/2015
Status:Open Resolved:
Product: Product Version:
Classification: Reproducible:
 
Summary:
Xcode 7 enables -Wnullable-to-nonnull-conversion. This produces many warnings in Obj-C which can be silenced with explicit casts to __nonnull, but there are so many that it's difficult and unreadable to do this everywhere.

Lacking better inference and more thorough audits of framework code (namely whether various APIs accept null or would crash), it would be great to have some shorthand for this, like Swift's postfix "!".

The warning is
"error: implicit conversion from nullable pointer 'NSString * __nullable' to non-nullable pointer type 'NSString * __nonnull' [-Werror,-Wnullable-to-nonnull-conversion]"

Version:
Xcode 7 beta 1

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!