Fix SelfComparison lint error in NativeModuleRegistry.kt (#55444)

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

Fixed SelfComparison lint error by extracting the compared values into separate local variables, making it clearer to the linter that we're comparing two different instances.

The original code was comparing `this.reactApplicationContext` with `newRegister.reactApplicationContext`, but the linter incorrectly flagged it as a self-comparison due to the same property name.

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D91797839

fbshipit-source-id: 5f475490c7e167eff46108e3a9c48b9072853f50
This commit is contained in:
David Vacca authored and meta-codesync[bot] committed 2026-02-08 15:29:11 -08:00
1 parent f0062401ff
commit f4128871da
1 file changed
+3 -1
@@ -46,7 +46,9 @@ public class NativeModuleRegistry(
) // This is needed till there are Java Consumer of this API inside React
// Native
internal fun registerModules(newRegister: NativeModuleRegistry) {
check(reactApplicationContext == newRegister.reactApplicationContext) {
val ownContext = reactApplicationContext
val otherContext = newRegister.reactApplicationContext
check(ownContext == otherContext) {
"Extending native modules with non-matching application contexts."
}