Skip to content

Commit f412887

Browse files
mdvaccameta-codesync[bot]
authored andcommitted
Fix SelfComparison lint error in NativeModuleRegistry.kt (#55444)
Summary: Pull Request resolved: #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
1 parent f006240 commit f412887

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ public class NativeModuleRegistry(
4646
) // This is needed till there are Java Consumer of this API inside React
4747
// Native
4848
internal fun registerModules(newRegister: NativeModuleRegistry) {
49-
check(reactApplicationContext == newRegister.reactApplicationContext) {
49+
val ownContext = reactApplicationContext
50+
val otherContext = newRegister.reactApplicationContext
51+
check(ownContext == otherContext) {
5052
"Extending native modules with non-matching application contexts."
5153
}
5254

0 commit comments

Comments
 (0)