From f4128871daf970a5dfb8fc184fd5ae456415e0dd Mon Sep 17 00:00:00 2001 From: David Vacca Date: Sun, 8 Feb 2026 15:29:11 -0800 Subject: [PATCH] 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 --- .../java/com/facebook/react/bridge/NativeModuleRegistry.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.kt index dcf2e1946cd..d0c9df1942e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.kt @@ -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." }