From d1e7caa1d44c0edda0e5d5ea98a80b57837fa18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Wed, 7 Feb 2024 12:27:15 -0800 Subject: [PATCH] Mark override and dangerouslyReset in ReactNativeFeatureFlags as JVM static (#42908) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/42908 Changelog: [internal] Just a small ergonomic improvement to do `ReactNativeFeatureFlags.override` instead of `ReactNativeFeatureFlags.INSTANCE.override` in Java. We already did this for the methods to access the feature flags in the same class. Reviewed By: rshest Differential Revision: D53516254 fbshipit-source-id: cdaa90b3baae4f780a42a96ebb07de78bd968019 --- .../react/internal/featureflags/ReactNativeFeatureFlags.kt | 4 +++- .../templates/android/ReactNativeFeatureFlags.kt-template.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index fed18a18fc7..0740394203b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<435993f24b4bdc9740491d5540232a9c>> */ /** @@ -84,6 +84,7 @@ object ReactNativeFeatureFlags { * }) * ``` */ + @JvmStatic fun override(provider: ReactNativeFeatureFlagsProvider) = accessor.override(provider) /** @@ -95,6 +96,7 @@ object ReactNativeFeatureFlags { * call `dangerouslyReset` after destroying the runtime and `override` * again before initializing the new one. */ + @JvmStatic fun dangerouslyReset() { // This is necessary when the accessor interops with C++ and we need to // remove the overrides set there. diff --git a/packages/react-native/scripts/featureflags/templates/android/ReactNativeFeatureFlags.kt-template.js b/packages/react-native/scripts/featureflags/templates/android/ReactNativeFeatureFlags.kt-template.js index 520dc13456c..33924031a92 100644 --- a/packages/react-native/scripts/featureflags/templates/android/ReactNativeFeatureFlags.kt-template.js +++ b/packages/react-native/scripts/featureflags/templates/android/ReactNativeFeatureFlags.kt-template.js @@ -61,6 +61,7 @@ ${Object.entries(definitions.common) * }) * \`\`\` */ + @JvmStatic fun override(provider: ReactNativeFeatureFlagsProvider) = accessor.override(provider) /** @@ -72,6 +73,7 @@ ${Object.entries(definitions.common) * call \`dangerouslyReset\` after destroying the runtime and \`override\` * again before initializing the new one. */ + @JvmStatic fun dangerouslyReset() { // This is necessary when the accessor interops with C++ and we need to // remove the overrides set there.