From 3c32da5bfeb9b284b5b8a0a2a92f02bd1430aa3e Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Fri, 8 Nov 2024 04:31:46 -0800 Subject: [PATCH] Convert com.facebook.react.bridge.NativeArray to Kotlin (#47456) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47456 Changelog: [Internal] Reviewed By: tdn120 Differential Revision: D65486257 fbshipit-source-id: d18d38fd7e605918d79e370dda7df51abac2f23c --- .../facebook/react/bridge/NativeArray.java | 24 ------------------ .../com/facebook/react/bridge/NativeArray.kt | 25 +++++++++++++++++++ 2 files changed, 25 insertions(+), 24 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.java deleted file mode 100644 index 2a5233427ab..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.java +++ /dev/null @@ -1,24 +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 com.facebook.jni.HybridClassBase; -import com.facebook.proguard.annotations.DoNotStrip; - -/** Base class for an array whose members are stored in native code (C++). */ -@DoNotStrip -public abstract class NativeArray extends HybridClassBase implements NativeArrayInterface { - static { - ReactBridge.staticInit(); - } - - protected NativeArray() {} - - @Override - public native String toString(); -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.kt new file mode 100644 index 00000000000..e70f2d76eec --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.kt @@ -0,0 +1,25 @@ +/* + * 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 + +/** Base class for an array whose members are stored in native code (C++). */ +@DoNotStrip +public abstract class NativeArray protected constructor() : + HybridClassBase(), NativeArrayInterface { + + external override fun toString(): String + + private companion object { + init { + ReactBridge.staticInit() + } + } +}