Mark Bridge classes as LegacyArchitecture (#49763)

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

Mark Bridge classes as LegacyArchitecture

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D70429646

fbshipit-source-id: 12b4ff95f337b046a9f377529d92eac70c16e7ea
This commit is contained in:
David Vacca
2025-03-03 17:31:27 -08:00
committed by Facebook GitHub Bot
parent a8c4b3a274
commit 7d71f5d2de
22 changed files with 52 additions and 0 deletions
@@ -22,6 +22,7 @@ import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
import com.facebook.react.common.annotations.FrameworkAPI;
import com.facebook.react.common.annotations.UnstableReactNativeAPI;
import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
import java.util.Collection;
@@ -33,6 +34,7 @@ import java.util.Collection;
*/
@DeprecatedInNewArchitecture
@VisibleForTesting
@LegacyArchitecture
public class BridgeReactContext extends ReactApplicationContext {
@DoNotStrip
public interface RCTDeviceEventEmitter extends JavaScriptModule {
@@ -26,6 +26,7 @@ import com.facebook.react.bridge.queue.ReactQueueConfigurationImpl;
import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModuleRegistry;
import com.facebook.react.module.annotations.ReactModule;
@@ -44,6 +45,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* is built by XReactInstanceManager which is in a different package.
*/
@DoNotStrip
@LegacyArchitecture
public class CatalystInstanceImpl implements CatalystInstance {
static {
ReactBridge.staticInit();
@@ -9,9 +9,11 @@ package com.facebook.react.bridge
import com.facebook.jni.HybridClassBase
import com.facebook.proguard.annotations.DoNotStrip
import com.facebook.react.common.annotations.internal.LegacyArchitecture
/** Callback impl that calls directly into the cxx bridge. Created from C++. */
@DoNotStrip
@LegacyArchitecture
public class CxxCallbackImpl @DoNotStrip private constructor() : HybridClassBase(), Callback {
override fun invoke(vararg args: Any?) {
nativeInvoke(Arguments.fromJavaArgs(args))
@@ -9,8 +9,10 @@ package com.facebook.react.bridge
import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import com.facebook.react.common.annotations.internal.LegacyArchitecture
/** This does nothing interesting, except avoid breaking existing code. */
@DoNotStrip
@LegacyArchitecture
public open class CxxModuleWrapper protected constructor(hybridData: HybridData) :
CxxModuleWrapperBase(hybridData)
@@ -9,6 +9,7 @@ package com.facebook.react.bridge;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
/**
* A Java Object which represents a cross-platform C++ module
@@ -17,6 +18,7 @@ import com.facebook.proguard.annotations.DoNotStrip;
* the underlying Cxx module will be extracted by the bridge and called directly.
*/
@DoNotStrip
@LegacyArchitecture
public class CxxModuleWrapperBase implements NativeModule {
static {
ReactBridge.staticInit();
@@ -8,11 +8,13 @@
package com.facebook.react.bridge
import com.facebook.proguard.annotations.DoNotStrip
import com.facebook.react.common.annotations.internal.LegacyArchitecture
/**
* Exception thrown by [ReadableMapKeySetIterator.nextKey] when the iterator tries to iterate over
* elements after the end of the key set.
*/
@DoNotStrip
@LegacyArchitecture
public class InvalidIteratorException @DoNotStrip public constructor(msg: String) :
RuntimeException(msg) {}
@@ -7,10 +7,13 @@
package com.facebook.react.bridge
import com.facebook.react.common.annotations.internal.LegacyArchitecture
/**
* This interface includes the methods needed to use a running JS instance, without specifying any
* of the bridge-specific initialization or lifecycle management.
*/
@LegacyArchitecture
public interface JSInstance {
public fun invokeCallback(callbackID: Int, arguments: NativeArrayInterface)
@@ -7,11 +7,13 @@
package com.facebook.react.bridge;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
import java.util.Iterator;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@LegacyArchitecture
public class JSONArguments {
/**
* Parse JSONObject to ReadableMap
@@ -14,10 +14,12 @@ import androidx.annotation.Nullable;
import com.facebook.debug.holder.PrinterHolder;
import com.facebook.debug.tags.ReactDebugOverlayTags;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
import com.facebook.systrace.SystraceMessage;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@LegacyArchitecture
class JavaMethodWrapper implements JavaModuleWrapper.NativeMethod {
private abstract static class ArgumentExtractor<T> {
@@ -15,6 +15,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
import androidx.annotation.Nullable;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import com.facebook.systrace.Systrace;
import com.facebook.systrace.SystraceMessage;
@@ -29,6 +30,7 @@ import java.util.Map;
* read and means fewer JNI calls.
*/
@DoNotStrip
@LegacyArchitecture
class JavaModuleWrapper {
interface NativeMethod {
@@ -7,6 +7,9 @@
package com.facebook.react.bridge
import com.facebook.react.common.annotations.internal.LegacyArchitecture
@LegacyArchitecture
public enum class MemoryPressure {
UI_HIDDEN,
MODERATE,
@@ -7,7 +7,10 @@
package com.facebook.react.bridge
import com.facebook.react.common.annotations.internal.LegacyArchitecture
/** Exception thrown when a native module method call receives unexpected arguments from JS. */
@LegacyArchitecture
internal class NativeArgumentsParseException : JSApplicationCausedNativeException {
constructor(detailMessage: String) : super(detailMessage)
@@ -7,7 +7,10 @@
package com.facebook.react.bridge
import com.facebook.react.common.annotations.internal.LegacyArchitecture
/** Interface for a module that will be notified when a batch of JS->Java calls has finished. */
@LegacyArchitecture
public fun interface OnBatchCompleteListener {
public fun onBatchComplete()
}
@@ -8,10 +8,12 @@
package com.facebook.react.bridge
import android.os.SystemClock
import com.facebook.react.common.annotations.internal.LegacyArchitecture
import com.facebook.soloader.SoLoader
import com.facebook.systrace.Systrace
import com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE
@LegacyArchitecture
internal object ReactBridge {
@Volatile private var _loadStartTime: Long = 0
@Volatile private var _loadEndTime: Long = 0
@@ -10,6 +10,7 @@ package com.facebook.react.bridge;
import android.app.Activity;
import androidx.annotation.Nullable;
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
/**
* Base class for Catalyst native modules that require access to the {@link ReactContext} instance.
@@ -18,6 +19,7 @@ import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
message =
"ReactContextBaseJavaModule will be deprecated in new Architecture of React Native, use"
+ " BaseJavaModule instead")
@LegacyArchitecture
public abstract class ReactContextBaseJavaModule extends BaseJavaModule {
public ReactContextBaseJavaModule() {
@@ -9,9 +9,11 @@ package com.facebook.react.bridge;
import com.facebook.common.logging.FLog;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
import java.lang.reflect.Method;
@DoNotStrip
@LegacyArchitecture
public class ReactCxxErrorHandler {
private static Method mHandleErrorFunc;
@@ -10,6 +10,7 @@ package com.facebook.react.bridge;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStripAny;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
import com.facebook.react.devsupport.inspector.InspectorNetworkRequestListener;
import java.util.Map;
import java.util.concurrent.Executor;
@@ -17,6 +18,7 @@ import javax.annotation.Nullable;
@DoNotStripAny
@Nullsafe(Nullsafe.Mode.LOCAL)
@LegacyArchitecture
public class ReactInstanceManagerInspectorTarget implements AutoCloseable {
@DoNotStripAny
public interface TargetDelegate {
@@ -6,6 +6,9 @@
*/
package com.facebook.react.bridge
import com.facebook.react.common.annotations.internal.LegacyArchitecture
/**
* Annotation which is used to mark methods that are exposed to React Native.
*
@@ -14,6 +17,7 @@ package com.facebook.react.bridge
* for each.
*/
@Retention(AnnotationRetention.RUNTIME)
@LegacyArchitecture
public annotation class ReactMethod(
/**
* Whether the method can be called from JS synchronously **on the JS thread**, possibly
@@ -8,7 +8,9 @@
package com.facebook.react.bridge
import com.facebook.proguard.annotations.DoNotStripAny
import com.facebook.react.common.annotations.internal.LegacyArchitecture
@DoNotStripAny
@Deprecated("Use [TurboModule] to identify generated specs")
@LegacyArchitecture
public interface ReactModuleWithSpec
@@ -7,6 +7,9 @@
package com.facebook.react.bridge
import com.facebook.react.common.annotations.internal.LegacyArchitecture
@LegacyArchitecture
public class ReactNoCrashBridgeNotAllowedSoftException : ReactNoCrashSoftException {
public constructor(m: String) : super(m)
@@ -7,10 +7,13 @@
package com.facebook.react.bridge
import com.facebook.react.common.annotations.internal.LegacyArchitecture
/**
* [UIManagerProvider] is used to create UIManager objects during the initialization of React
* Native.
*/
@LegacyArchitecture
public fun interface UIManagerProvider {
/* Provides a [com.facebook.react.bridge.UIManager] for the context received as a parameter. */
@@ -8,6 +8,7 @@
package com.facebook.react.bridge.interop
import com.facebook.react.bridge.JavaScriptModule
import com.facebook.react.common.annotations.internal.LegacyArchitecture
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags.enableFabricRenderer
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags.useFabricInterop
@@ -19,6 +20,7 @@ import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags.useFabri
* Currently we only support a `RCTEventEmitter` re-implementation, being `InteropEventEmitter` but
* this class can support other re-implementation in the future.
*/
@LegacyArchitecture
internal class InteropModuleRegistry {
private val supportedModules = mutableMapOf<Class<*>, Any?>()