-
Notifications
You must be signed in to change notification settings - Fork 547
Nullability
TJ Lambert edited this page Feb 14, 2022
·
2 revisions
- ASAP - there’s nothing blocking us
- the generator handle them using
[NullAllowed]attributes - xtro report warnings for missing and extra null allowed, based on ObjC headers
-
important: headers are not always 100% accurate so it’s worth checking:
- git history if we allowed it (and headers disagree) and
- if we have unit tests for the API (that prove it works)
-
important: headers are not always 100% accurate so it’s worth checking:
- For each framework then xtro entries must all be fixed before starting on the manual bindings
- because doing binding files later would introduce issues (and re-work)
- Quick-check (for ARKit, empty result means it’s complete)
cd tests/xtro-sharpie
git grep null-allowed *.ignore | grep ARKit- For all
.csfiles- should have
#nullable enable- quick check
git grep -L "#nullable enable" .inside framework directory, e.g.src/ARKit. No output means every file has the pragma directive
- quick check
- should have
- build without errors
-
warnaserroris enabled for nullability (somakeis all that should be needed)
-
- Use
ObjCRuntime.ThrowHelper.Throw``**ArgumentNullException**instead of directly throwing- it’s a size saving optimization - but it also shows we reviewed the code for nullability
- quick check:
git grep " ArgumentNullException" .inside framework directory, e.g.ARKit. No output means nothing throw anArgumentNullExceptionmanually (without the helper)
- Replace
== nulland!= nullwith the neweris nullandis not nullto avoid using any == or != overrides.