Skip to content

Commit ca5d940

Browse files
fabriziocuccifacebook-github-bot
authored andcommitted
Kotlinify CallInvokerHolderImpl (facebook#43796)
Summary: Pull Request resolved: facebook#43796 Changelog: [Internal] As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)). Reviewed By: cortinico Differential Revision: D55655061 fbshipit-source-id: fd2c81ce91681f9f26e2b4a659b8fbae8a4b7d51
1 parent e180072 commit ca5d940

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3869,7 +3869,7 @@ public abstract interface class com/facebook/react/touch/ReactInterceptingViewGr
38693869
public abstract fun setOnInterceptTouchEventListener (Lcom/facebook/react/touch/OnInterceptTouchEventListener;)V
38703870
}
38713871

3872-
public class com/facebook/react/turbomodule/core/CallInvokerHolderImpl : com/facebook/react/turbomodule/core/interfaces/CallInvokerHolder {
3872+
public final class com/facebook/react/turbomodule/core/CallInvokerHolderImpl : com/facebook/react/turbomodule/core/interfaces/CallInvokerHolder {
38733873
}
38743874

38753875
public class com/facebook/react/turbomodule/core/NativeMethodCallInvokerHolderImpl : com/facebook/react/turbomodule/core/interfaces/NativeMethodCallInvokerHolder {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/NativeModuleSoLoader.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ package com.facebook.react.internal.turbomodule.core
99

1010
import com.facebook.soloader.SoLoader
1111

12-
internal class NativeModuleSoLoader {
13-
companion object {
12+
public class NativeModuleSoLoader {
13+
public companion object {
1414
private var isSoLibraryLoaded = false
1515

1616
@Synchronized
1717
@JvmStatic
18-
fun maybeLoadSoLibrary() {
18+
public fun maybeLoadSoLibrary() {
1919
if (!isSoLibraryLoaded) {
2020
SoLoader.loadLibrary("turbomodulejsijni")
2121
isSoLibraryLoaded = true

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/CallInvokerHolderImpl.java renamed to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/CallInvokerHolderImpl.kt

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,25 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
package com.facebook.react.turbomodule.core;
8+
package com.facebook.react.turbomodule.core
99

10-
import com.facebook.infer.annotation.Nullsafe;
11-
import com.facebook.jni.HybridData;
12-
import com.facebook.proguard.annotations.DoNotStrip;
13-
import com.facebook.react.common.annotations.FrameworkAPI;
14-
import com.facebook.react.internal.turbomodule.core.NativeModuleSoLoader;
15-
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
10+
import com.facebook.jni.HybridData
11+
import com.facebook.proguard.annotations.DoNotStrip
12+
import com.facebook.react.common.annotations.FrameworkAPI
13+
import com.facebook.react.internal.turbomodule.core.NativeModuleSoLoader
14+
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder
1615

1716
/**
1817
* JSCallInvoker is created at a different time/place (i.e: in CatalystInstance) than
1918
* TurboModuleManager. Therefore, we need to wrap JSCallInvoker within a hybrid class so that we may
2019
* pass it from CatalystInstance, through Java, to TurboModuleManager::initHybrid.
2120
*/
22-
@Nullsafe(Nullsafe.Mode.LOCAL)
2321
@FrameworkAPI
24-
public class CallInvokerHolderImpl implements CallInvokerHolder {
25-
26-
@DoNotStrip private final HybridData mHybridData;
27-
28-
static {
29-
NativeModuleSoLoader.maybeLoadSoLibrary();
30-
}
31-
32-
private CallInvokerHolderImpl(HybridData hd) {
33-
mHybridData = hd;
22+
public class CallInvokerHolderImpl
23+
private constructor(@field:DoNotStrip private val mHybridData: HybridData) : CallInvokerHolder {
24+
private companion object {
25+
init {
26+
NativeModuleSoLoader.maybeLoadSoLibrary()
27+
}
3428
}
3529
}

0 commit comments

Comments
 (0)