Skip to content

Commit 265f36f

Browse files
RSNarafacebook-github-bot
authored andcommitted
both: Deprecate c++ legacy core classes
Summary: Let's deprecate all the classes that aren't used by interop or the new architecture. Changelog: [General][Deprecated] - Deprecate all the c++ classes not used by interop, or the new architecture. Differential Revision: D80575767
1 parent 028e582 commit 265f36f

23 files changed

+90
-32
lines changed

packages/react-native/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ namespace facebook::react {
4545

4646
namespace {
4747

48-
class InstanceCallbackImpl : public InstanceCallback {
48+
class [[deprecated(
49+
"This API will be removed along with the legacy architecture.")]] InstanceCallbackImpl
50+
: public InstanceCallback {
4951
public:
5052
explicit InstanceCallbackImpl(alias_ref<JInstanceCallback::javaobject> jobj)
5153
: jobj_(make_global(jobj)) {}

packages/react-native/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ class Instance;
2929
class JavaScriptExecutorHolder;
3030
class NativeArray;
3131

32-
struct JInstanceCallback : public jni::JavaClass<JInstanceCallback> {
32+
struct [[deprecated(
33+
"This API will be removed along with the legacy architecture.")]] JInstanceCallback
34+
: public jni::JavaClass<JInstanceCallback> {
3335
static constexpr auto kJavaDescriptor =
3436
"Lcom/facebook/react/bridge/CatalystInstanceImpl$InstanceCallback;";
3537
};
3638

37-
class CatalystInstanceImpl : public jni::HybridClass<CatalystInstanceImpl> {
39+
class [[deprecated(
40+
"This API will be removed along with the legacy architecture.")]] CatalystInstanceImpl
41+
: public jni::HybridClass<CatalystInstanceImpl> {
3842
public:
3943
static constexpr auto kJavaDescriptor =
4044
"Lcom/facebook/react/bridge/CatalystInstanceImpl;";

packages/react-native/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ namespace facebook::react {
2020
class Instance;
2121
class MessageQueueThread;
2222

23-
struct JMethodDescriptor : public jni::JavaClass<JMethodDescriptor> {
23+
struct [[deprecated(
24+
"This API will be removed along with the legacy architecture.")]] JMethodDescriptor
25+
: public jni::JavaClass<JMethodDescriptor> {
2426
static constexpr auto kJavaDescriptor =
2527
"Lcom/facebook/react/bridge/JavaModuleWrapper$MethodDescriptor;";
2628

@@ -30,7 +32,9 @@ struct JMethodDescriptor : public jni::JavaClass<JMethodDescriptor> {
3032
std::string getType() const;
3133
};
3234

33-
struct JavaModuleWrapper : jni::JavaClass<JavaModuleWrapper> {
35+
struct [[deprecated(
36+
"This API will be removed along with the legacy architecture.")]] JavaModuleWrapper
37+
: jni::JavaClass<JavaModuleWrapper> {
3438
static constexpr auto kJavaDescriptor =
3539
"Lcom/facebook/react/bridge/JavaModuleWrapper;";
3640

@@ -59,7 +63,9 @@ struct JavaModuleWrapper : jni::JavaClass<JavaModuleWrapper> {
5963
}
6064
};
6165

62-
class JavaNativeModule : public NativeModule {
66+
class [[deprecated(
67+
"This API will be removed along with the legacy architecture.")]] JavaNativeModule
68+
: public NativeModule {
6369
public:
6470
JavaNativeModule(
6571
std::weak_ptr<Instance> instance,

packages/react-native/ReactAndroid/src/main/jni/react/jni/JavaScriptExecutorHolder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
namespace facebook::react {
1616

17-
class JavaScriptExecutorHolder
17+
class [[deprecated(
18+
"This API will be removed along with the legacy architecture.")]] JavaScriptExecutorHolder
1819
: public jni::HybridClass<JavaScriptExecutorHolder> {
1920
public:
2021
static constexpr auto kJavaDescriptor =

packages/react-native/ReactAndroid/src/main/jni/react/jni/JniJSModulesUnbundle.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
namespace facebook::react {
1818

19-
class JniJSModulesUnbundle : public JSModulesUnbundle {
19+
class [[deprecated(
20+
"This API will be removed along with the legacy architecture.")]] JniJSModulesUnbundle
21+
: public JSModulesUnbundle {
2022
/**
2123
* This implementation reads modules as single file from the assets of an apk.
2224
*/

packages/react-native/ReactAndroid/src/main/jni/react/jni/MethodInvoker.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ local_ref<JCxxCallbackImpl::jhybridobject> extractCallback(
8080
if (value.isNull()) {
8181
return {nullptr};
8282
} else {
83+
#pragma clang diagnostic push
84+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
8385
return JCxxCallbackImpl::newObjectCxxArgs(makeCallback(instance, value));
86+
#pragma clang diagnostic pop
8487
}
8588
}
8689

packages/react-native/ReactAndroid/src/main/jni/react/jni/MethodInvoker.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ namespace facebook::react {
1919

2020
class Instance;
2121

22-
struct JReflectMethod : public jni::JavaClass<JReflectMethod> {
22+
struct [[deprecated(
23+
"This API will be removed along with the legacy architecture.")]] JReflectMethod
24+
: public jni::JavaClass<JReflectMethod> {
2325
static constexpr auto kJavaDescriptor = "Ljava/lang/reflect/Method;";
2426

2527
jmethodID getMethodID() {
@@ -29,12 +31,15 @@ struct JReflectMethod : public jni::JavaClass<JReflectMethod> {
2931
}
3032
};
3133

32-
struct JBaseJavaModule : public jni::JavaClass<JBaseJavaModule> {
34+
struct [[deprecated(
35+
"This API will be removed along with the legacy architecture.")]] JBaseJavaModule
36+
: public jni::JavaClass<JBaseJavaModule> {
3337
static constexpr auto kJavaDescriptor =
3438
"Lcom/facebook/react/bridge/BaseJavaModule;";
3539
};
3640

37-
class MethodInvoker {
41+
class [[deprecated(
42+
"This API will be removed along with the legacy architecture.")]] MethodInvoker {
3843
public:
3944
MethodInvoker(
4045
jni::alias_ref<JReflectMethod::javaobject> method,

packages/react-native/ReactAndroid/src/main/jni/react/jni/ModuleRegistryBuilder.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ namespace facebook::react {
2020

2121
class MessageQueueThread;
2222

23-
class ModuleHolder : public jni::JavaClass<ModuleHolder> {
23+
class [[deprecated(
24+
"This API will be removed along with the legacy architecture.")]] ModuleHolder
25+
: public jni::JavaClass<ModuleHolder> {
2426
public:
2527
static auto constexpr kJavaDescriptor =
2628
"Lcom/facebook/react/bridge/ModuleHolder;";
@@ -30,6 +32,7 @@ class ModuleHolder : public jni::JavaClass<ModuleHolder> {
3032
const std::string& moduleName) const;
3133
};
3234

35+
[[deprecated("This API will be removed along with the legacy architecture.")]]
3336
std::vector<std::unique_ptr<NativeModule>> buildNativeModuleList(
3437
std::weak_ptr<Instance> winstance,
3538
jni::alias_ref<jni::JCollection<JavaModuleWrapper::javaobject>::javaobject>

packages/react-native/ReactCommon/cxxreact/CxxNativeModule.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ class MessageQueueThread;
2323

2424
typedef void (*WarnOnUsageLogger)(std::string message);
2525

26+
[[deprecated("This API will be removed along with the legacy architecture.")]]
2627
std::function<void(folly::dynamic)> makeCallback(
2728
std::weak_ptr<Instance> instance,
2829
const folly::dynamic& callbackId);
2930

30-
class RN_EXPORT CxxNativeModule : public NativeModule {
31+
class RN_EXPORT [[deprecated(
32+
"This API will be removed along with the legacy architecture.")]] CxxNativeModule
33+
: public NativeModule {
3134
public:
3235
CxxNativeModule(
3336
std::weak_ptr<Instance> instance,

packages/react-native/ReactCommon/cxxreact/Instance.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@ class MessageQueueThread;
3434
class ModuleRegistry;
3535
class RAMBundleRegistry;
3636

37-
struct InstanceCallback {
37+
struct [[deprecated(
38+
"This API will be removed along with the legacy architecture.")]] InstanceCallback {
3839
virtual ~InstanceCallback() = default;
3940
virtual void onBatchComplete() {}
4041
virtual void incrementPendingJSCalls() {}
4142
virtual void decrementPendingJSCalls() {}
4243
};
4344

44-
class RN_EXPORT Instance : private jsinspector_modern::InstanceTargetDelegate {
45+
class RN_EXPORT [[deprecated(
46+
"This API will be removed along with the legacy architecture.")]] Instance
47+
: private jsinspector_modern::InstanceTargetDelegate {
4548
public:
4649
~Instance() override;
4750
void initializeBridge(

0 commit comments

Comments
 (0)