Convert CxxCallbackImpl to Kotlin (#49004)

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

This just converts yet another class to Kotlin.

Changelog:
[Internal] [Changed] -

Reviewed By: tdn120

Differential Revision: D68772336

fbshipit-source-id: 428cb3a0d54bf7a22f0e4eb07268cdc27ef6f2c3
This commit is contained in:
Nicola Corti
2025-01-28 11:01:59 -08:00
committed by Facebook GitHub Bot
parent 156ee5bee7
commit 362a191aee
3 changed files with 22 additions and 29 deletions
@@ -716,7 +716,7 @@ public class com/facebook/react/bridge/ColorPropConverter {
public static fun resolveResourcePath (Landroid/content/Context;Ljava/lang/String;)Ljava/lang/Integer;
}
public class com/facebook/react/bridge/CxxCallbackImpl : com/facebook/jni/HybridClassBase, com/facebook/react/bridge/Callback {
public final class com/facebook/react/bridge/CxxCallbackImpl : com/facebook/jni/HybridClassBase, com/facebook/react/bridge/Callback {
public fun invoke ([Ljava/lang/Object;)V
}
@@ -1,28 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.bridge;
import static com.facebook.react.bridge.Arguments.*;
import com.facebook.jni.HybridClassBase;
import com.facebook.proguard.annotations.DoNotStrip;
/** Callback impl that calls directly into the cxx bridge. Created from C++. */
@DoNotStrip
public class CxxCallbackImpl extends HybridClassBase implements Callback {
@DoNotStrip
private CxxCallbackImpl() {}
@Override
public void invoke(Object... args) {
nativeInvoke(fromJavaArgs(args));
}
private native void nativeInvoke(NativeArray arguments);
}
@@ -0,0 +1,21 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.bridge
import com.facebook.jni.HybridClassBase
import com.facebook.proguard.annotations.DoNotStrip
/** Callback impl that calls directly into the cxx bridge. Created from C++. */
@DoNotStrip
public class CxxCallbackImpl @DoNotStrip private constructor() : HybridClassBase(), Callback {
override fun invoke(vararg args: Any?) {
nativeInvoke(Arguments.fromJavaArgs(args))
}
private external fun nativeInvoke(arguments: NativeArray)
}