Skip to content

Convert FabricUIManager from Java to Kotlin#57106

Open
cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D107865206
Open

Convert FabricUIManager from Java to Kotlin#57106
cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D107865206

Conversation

@cortinico

Copy link
Copy Markdown
Contributor

Summary:
This diff converts FabricUIManager.java to Kotlin as part of the ongoing React Native Android Java-to-Kotlin migration effort.

Key changes:

  • Converted the class from Java to Kotlin with idiomatic patterns
  • Removed Hungarian notation from all private fields (e.g. mBinding -> uiManagerBinding, mDestroyed -> destroyed)
  • Static fields (TAG, IS_DEVELOPMENT_ENVIRONMENT) and static initializer moved to companion object with JvmField for binary compatibility
  • eventDispatcher and performanceCounters implemented as override val properties matching Kotlin interface definitions
  • Package-private methods (setBinding, createDispatchCommandMountItemForInterop) mapped to internal
  • All !! operator usages replaced with checkNotNull/requireNotNull for safer null handling
  • Nullable commandArgs passed through via unchecked cast to preserve original Java null-pass-through behavior
  • OptIn(UnstableReactNativeAPI::class) added at class level

Supporting changes required by the migration:

  • DevToolsReactPerfLogger.kt: private companion object changed to internal companion object since Kotlin enforces companion visibility that Java did not
  • SynchronousMountItem.kt: Import path updated to use FabricUIManager.Companion.IS_DEVELOPMENT_ENVIRONMENT
  • PreparedLayout.kt: Changed from internal to public because FabricUIManager public JNI-facing methods return/accept this type
  • ReactAndroid.api: Regenerated to reflect the updated API surface

Changelog: [Internal]

Differential Revision: D107865206

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 8, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Jun 8, 2026
@meta-codesync

meta-codesync Bot commented Jun 8, 2026

Copy link
Copy Markdown

@cortinico has exported this pull request. If you are a Meta employee, you can view the originating Diff in D107865206.

@cortinico cortinico force-pushed the export-D107865206 branch 6 times, most recently from 21294b7 to b9aa33f Compare June 9, 2026 10:40
Summary:
This diff converts `FabricUIManager.java` to Kotlin as part of the ongoing React Native Android Java-to-Kotlin migration effort.

Key changes:
- Converted the class from Java to Kotlin with idiomatic patterns
- Removed Hungarian notation from all private fields (e.g. `mBinding` -> `uiManagerBinding`, `mDestroyed` -> `destroyed`)
- Static fields (`TAG`, `IS_DEVELOPMENT_ENVIRONMENT`) and static initializer moved to `companion object` with `JvmField` for binary compatibility
- `eventDispatcher` and `performanceCounters` implemented as `override val` properties matching Kotlin interface definitions
- Package-private methods (`setBinding`, `createDispatchCommandMountItemForInterop`) mapped to `internal`
- All `!!` operator usages replaced with `checkNotNull`/`requireNotNull` for safer null handling
- Nullable `commandArgs` passed through via unchecked cast to preserve original Java null-pass-through behavior
- `OptIn(UnstableReactNativeAPI::class)` added at class level

Supporting changes required by the migration:
- `DevToolsReactPerfLogger.kt`: `private companion object` changed to `internal companion object` since Kotlin enforces companion visibility that Java did not
- `SynchronousMountItem.kt`: Import path updated to use `FabricUIManager.Companion.IS_DEVELOPMENT_ENVIRONMENT`
- `PreparedLayout.kt`: Changed from `internal` to `public` because `FabricUIManager` public JNI-facing methods return/accept this type
- `ReactAndroid.api`: Regenerated to reflect the updated API surface

Changelog: [Internal]

Differential Revision: D107865206
@cortinico cortinico force-pushed the export-D107865206 branch from b9aa33f to 9558ebf Compare June 9, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant