Skip to content

Conversation

@mdvacca
Copy link
Contributor

@mdvacca mdvacca commented Jan 29, 2026

Summary:
Fixed FieldsBelowInit lint error in ReactSurfaceView.kt.

Moved the viewportOffset property declaration above the init block to ensure proper initialization order and satisfy Kotlin best practices for property declarations.

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D91732184

@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 Jan 29, 2026
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Jan 29, 2026
Copy link
Contributor

@cortinico cortinico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

Summary:
**Lint Issue:** ANDROIDLINT FieldsBelowInit warning on line 347.

The `nativeModules` property was declared below the init block. The lint warns that fields declared after init blocks can lead to initialization order issues in Kotlin, where the field might not be available during the init block execution.

**Fix:** Moved the `nativeModules` computed property declaration to before the init block, alongside other property declarations. Since this is a computed property (getter only), there's no actual initialization order issue, but placing it before the init block follows Kotlin best practices and avoids confusion.

Differential Revision: D91709480
Summary:
**Lint Issue:** ANDROIDLINT FieldsBelowInit warning on line 480.

The `eventDispatcher` property was declared below the init block. The lint warns that fields declared after init blocks can lead to initialization order issues in Kotlin, where the field might not be available during the init block execution.

**Fix:** Moved the `eventDispatcher` computed property declaration to before the init block, alongside other property declarations. Since this is a computed property (getter only) that returns `fabricUIManager.eventDispatcher`, there's no actual initialization order issue, but placing it before the init block follows Kotlin best practices and avoids confusion.

Differential Revision: D91709482
Summary:
**Lint Issue:** ANDROIDLINT KotlinGenericsCast warning on line 361.

The `getNativeModule` function casts `turboModuleManager.getModule(nativeModuleName)` to generic type `T?`. The lint warns that casts to erased Kotlin generic type references are only checked at compile time, and at runtime, casts to type arguments of a generic function are unchecked due to type erasure.

**Fix:** Added `SuppressLint("KotlinGenericsCast")` annotation to the function. The existing `Suppress("UNCHECKED_CAST")` only suppresses the Kotlin compiler warning, not the AndroidLint warning. This cast is intentional and unavoidable given the API design where callers specify the expected return type.

Differential Revision: D91709481
Summary:
Fixed EmptyCatchBlock lint error in BridgelessAtomicRef.kt.

Added a comment explaining that the InterruptedException is intentionally
caught to record the interrupt status, which is then restored after the
wait loop completes. This is a standard pattern for proper interrupt handling.

changelog: [internal] internal

Differential Revision: D91728772
Summary:
Fixed UnsafeDereference lint errors in BridgelessCatalystInstance.kt.

Replaced unsafe !! operator with requireNotNull() for:
- javaScriptContextHolder
- jsCallInvokerHolder
- reactQueueConfiguration

This provides better error messages when null values are encountered.

changelog: [internal] internal

Differential Revision: D91731458
…t block

Summary:
Fixed FieldsBelowInit lint errors in BridgelessReactContext.kt.

Moved property declarations (devSupportManager, defaultHardwareBackBtnHandler) above the init block to ensure proper initialization order.

Also added Suppress for KotlinGenericsCast warning on the generic cast that is necessary for the proxy implementation.

changelog: [internal] internal

Differential Revision: D91731938
Summary:
Fixed FieldsBelowInit lint error in ReactSurfaceView.kt.

Moved the viewportOffset property declaration above the init block to ensure proper initialization order and satisfy Kotlin best practices for property declarations.

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D91732184
@meta-codesync
Copy link

meta-codesync bot commented Jan 29, 2026

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

mdvacca added a commit to mdvacca/react-native that referenced this pull request Jan 29, 2026
…acebook#55358)

Summary:

Fixed FieldsBelowInit lint error in ReactSurfaceView.kt.

Moved the viewportOffset property declaration above the init block to ensure proper initialization order and satisfy Kotlin best practices for property declarations.

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D91732184
mdvacca added a commit to mdvacca/react-native that referenced this pull request Jan 29, 2026
…acebook#55358)

Summary:

Fixed FieldsBelowInit lint error in ReactSurfaceView.kt.

Moved the viewportOffset property declaration above the init block to ensure proper initialization order and satisfy Kotlin best practices for property declarations.

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D91732184
mdvacca added a commit to mdvacca/react-native that referenced this pull request Jan 29, 2026
…acebook#55358)

Summary:

Fixed FieldsBelowInit lint error in ReactSurfaceView.kt.

Moved the viewportOffset property declaration above the init block to ensure proper initialization order and satisfy Kotlin best practices for property declarations.

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D91732184
mdvacca added a commit to mdvacca/react-native that referenced this pull request Jan 29, 2026
…acebook#55358)

Summary:

Fixed FieldsBelowInit lint error in ReactSurfaceView.kt.

Moved the viewportOffset property declaration above the init block to ensure proper initialization order and satisfy Kotlin best practices for property declarations.

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D91732184
@meta-codesync meta-codesync bot closed this in 41057d0 Jan 29, 2026
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 29, 2026
@meta-codesync
Copy link

meta-codesync bot commented Jan 29, 2026

This pull request has been merged in 41057d0.

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. fb-exported Merged This PR has been merged. meta-exported Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants