SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Normalize Objective-C nullability annotations (#55898)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55898

Normalize Objective-C nullability annotations in the cxx-api parser to ensure consistent output in API snapshots.

Objective-C has three different forms of nullability annotations that are semantically equivalent:
- `nonnull`/`nullable` (context-sensitive keywords)
- `_Nonnull`/`_Nullable` (type qualifiers)
- `__nonnull`/`__nullable` (legacy Apple macros)

This diff normalizes all forms to `_Nonnull`/`_Nullable` for consistency.

**Examples:**
- `nonnull NSString*` → `_Nonnull NSString*`
- `NSString* __nonnull` → `NSString* _Nonnull`
- `nullable id` → `_Nullable id`
- `id __nullable` → `id _Nullable`
- `NSString* _Nonnull` → `NSString* _Nonnull` (unchanged)

Added a test case to verify the normalization works correctly.

Changelog:
[Internal]

Reviewed By: cortinico

Differential Revision: D95195669

fbshipit-source-id: ca2afd14b3c8bf7e62864daf9c3848f5d713898e
D
Dawid Małecki committed
78c8842f9e85387bd3d87f8d96faab35913820d8
Parent: 725b056
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 3/5/2026, 3:21:42 PM