Skip to content

Commit

Permalink
Mark Bridge classes as LegacyArchitecture (facebook#49763)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#49763

Mark Bridge classes as LegacyArchitecture

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D70429646
  • Loading branch information
mdvacca committed Mar 3, 2025
1 parent 47f64f1 commit 1e399d1
Show file tree
Hide file tree
Showing 22 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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;

Expand All @@ -33,6 +34,7 @@
*/
@DeprecatedInNewArchitecture
@VisibleForTesting
@LegacyArchitecture
public class BridgeReactContext extends ReactApplicationContext {
@DoNotStrip
public interface RCTDeviceEventEmitter extends JavaScriptModule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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;
Expand All @@ -44,6 +45,7 @@
* is built by XReactInstanceManager which is in a different package.
*/
@DoNotStrip
@LegacyArchitecture
public class CatalystInstanceImpl implements CatalystInstance {
static {
ReactBridge.staticInit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

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
Expand All @@ -17,6 +18,7 @@
* the underlying Cxx module will be extracted by the bridge and called directly.
*/
@DoNotStrip
@LegacyArchitecture
public class CxxModuleWrapperBase implements NativeModule {
static {
ReactBridge.staticInit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
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> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

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;
Expand All @@ -29,6 +30,7 @@
* read and means fewer JNI calls.
*/
@DoNotStrip
@LegacyArchitecture
class JavaModuleWrapper {

interface NativeMethod {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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.
Expand All @@ -18,6 +19,7 @@
message =
"ReactContextBaseJavaModule will be deprecated in new Architecture of React Native, use"
+ " BaseJavaModule instead")
@LegacyArchitecture
public abstract class ReactContextBaseJavaModule extends BaseJavaModule {

public ReactContextBaseJavaModule() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
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;
import javax.annotation.Nullable;

@DoNotStripAny
@Nullsafe(Nullsafe.Mode.LOCAL)
@LegacyArchitecture
public class ReactInstanceManagerInspectorTarget implements AutoCloseable {
@DoNotStripAny
public interface TargetDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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?>()

Expand Down

0 comments on commit 1e399d1

Please sign in to comment.