From 1be65baf29967ec062f049d57d579694af816c1c Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Wed, 3 May 2023 13:01:02 -0700 Subject: [PATCH] Deprecate APIs that are deprecated only on JavaDoc (#37229) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37229 Those methods all have replacements and they have been annotated as `deprecated` but only on the Javadoc level. The Java compiler from 11 starts to emit warnigns for those functions so I'm actually annotating them with Deprecated correctly. Changelog: [Android] [Changed] - Deprecate APIs that are deprecate only on JavaDoc Reviewed By: mdvacca Differential Revision: D45525406 fbshipit-source-id: 9fea1a6374c9a14f7f07e5bca8db1221260c03fd --- .../src/main/java/com/facebook/react/ReactInstanceManager.java | 2 ++ .../src/main/java/com/facebook/react/bridge/NativeModule.java | 1 + .../src/main/java/com/facebook/react/bridge/ReactContext.java | 1 + .../com/facebook/react/modules/common/ModuleDataCleaner.java | 1 + .../src/main/java/com/facebook/react/uimanager/RootView.java | 1 + 5 files changed, 6 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java index c2a23b2c4c80f2..53b8e507d4a79c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java @@ -555,6 +555,7 @@ private void toggleElementInspector() { * @deprecated Use {@link #onHostPause(Activity)} instead. */ @ThreadConfined(UI) + @Deprecated public void onHostPause() { UiThreadUtil.assertOnUiThread(); @@ -669,6 +670,7 @@ public void onViewDetachedFromWindow(View v) { * @deprecated use {@link #onHostDestroy(Activity)} instead */ @ThreadConfined(UI) + @Deprecated public void onHostDestroy() { UiThreadUtil.assertOnUiThread(); diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java index 89e528d707de64..c5b1dfcf5439f6 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java @@ -52,6 +52,7 @@ interface NativeMethod { * * @deprecated use {@link #invalidate()} instead. */ + @Deprecated void onCatalystInstanceDestroy(); /** Allow NativeModule to clean up. Called before {CatalystInstance#onHostDestroy} */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java index 8765116263c9fb..dfe32f2dd92704 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java @@ -516,6 +516,7 @@ public boolean startActivityForResult(Intent intent, int code, Bundle bundle) { } /** @deprecated DO NOT USE, this method will be removed in the near future. */ + @Deprecated public boolean isBridgeless() { return false; } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/common/ModuleDataCleaner.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/common/ModuleDataCleaner.java index fabc71170f32a2..ed1b526ad1710d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/common/ModuleDataCleaner.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/common/ModuleDataCleaner.java @@ -43,6 +43,7 @@ public interface Cleanable { * * @deprecated */ + @Deprecated public static void cleanDataFromModules(CatalystInstance catalystInstance) { for (NativeModule nativeModule : catalystInstance.getNativeModules()) { if (nativeModule instanceof Cleanable) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootView.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootView.java index ca8fa5f65849ee..4e0e1723368e05 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootView.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootView.java @@ -20,6 +20,7 @@ public interface RootView { void onChildStartedNativeGesture(View childView, MotionEvent ev); /** @deprecated */ + @Deprecated void onChildStartedNativeGesture(MotionEvent ev); /**