Skip to content

Commit

Permalink
Undo move of CallInvokerHolder to .internal (#42362)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #42362

This undos a change of CallInvokerHolder bringing it back in the public package: b7191cde4e36

The problem is that if a developer wants to use the C++ CallInvokerHolder to schedule work on the JS thread from C++, they're forced to import the `.internal`
Java/Kotlin class.

Plus this is going to be a massive breaking change for the ecosystem:
https://github.com/search?type=code&q=%2Fimport.*CallInvokerHolderImpl%2F

So unless we come with a clear deprecation/replacement path, I'm undoing this change for now.

Changelog:
[Internal] [Changed] - Undo move of CallInvokerHolder to `.internal`

Reviewed By: cipolleschi

Differential Revision: D52873256

fbshipit-source-id: 900c3170ed2100ec706b03112bc23a0ba0171bcc
  • Loading branch information
cortinico authored and facebook-github-bot committed Jan 19, 2024
1 parent 26ecd38 commit fd0ca4d
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 22 deletions.
24 changes: 18 additions & 6 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,11 @@ public abstract interface class com/facebook/react/bridge/CatalystInstance : com
public abstract fun destroy ()V
public abstract fun extendNativeModules (Lcom/facebook/react/bridge/NativeModuleRegistry;)V
public abstract fun getFabricUIManager ()Lcom/facebook/react/bridge/UIManager;
public abstract fun getJSCallInvokerHolder ()Lcom/facebook/react/internal/turbomodule/core/interfaces/CallInvokerHolder;
public abstract fun getJSCallInvokerHolder ()Lcom/facebook/react/turbomodule/core/interfaces/CallInvokerHolder;
public abstract fun getJSIModule (Lcom/facebook/react/bridge/JSIModuleType;)Lcom/facebook/react/bridge/JSIModule;
public abstract fun getJSModule (Ljava/lang/Class;)Lcom/facebook/react/bridge/JavaScriptModule;
public abstract fun getJavaScriptContextHolder ()Lcom/facebook/react/bridge/JavaScriptContextHolder;
public abstract fun getNativeMethodCallInvokerHolder ()Lcom/facebook/react/internal/turbomodule/core/interfaces/NativeMethodCallInvokerHolder;
public abstract fun getNativeMethodCallInvokerHolder ()Lcom/facebook/react/turbomodule/core/interfaces/NativeMethodCallInvokerHolder;
public abstract fun getNativeModule (Ljava/lang/Class;)Lcom/facebook/react/bridge/NativeModule;
public abstract fun getNativeModule (Ljava/lang/String;)Lcom/facebook/react/bridge/NativeModule;
public abstract fun getNativeModules ()Ljava/util/Collection;
Expand Down Expand Up @@ -568,13 +568,13 @@ public class com/facebook/react/bridge/CatalystInstanceImpl : com/facebook/react
public fun destroy ()V
public fun extendNativeModules (Lcom/facebook/react/bridge/NativeModuleRegistry;)V
public fun getFabricUIManager ()Lcom/facebook/react/bridge/UIManager;
public fun getJSCallInvokerHolder ()Lcom/facebook/react/internal/turbomodule/core/CallInvokerHolderImpl;
public synthetic fun getJSCallInvokerHolder ()Lcom/facebook/react/internal/turbomodule/core/interfaces/CallInvokerHolder;
public fun getJSCallInvokerHolder ()Lcom/facebook/react/turbomodule/core/CallInvokerHolderImpl;
public synthetic fun getJSCallInvokerHolder ()Lcom/facebook/react/turbomodule/core/interfaces/CallInvokerHolder;
public fun getJSIModule (Lcom/facebook/react/bridge/JSIModuleType;)Lcom/facebook/react/bridge/JSIModule;
public fun getJSModule (Ljava/lang/Class;)Lcom/facebook/react/bridge/JavaScriptModule;
public fun getJavaScriptContextHolder ()Lcom/facebook/react/bridge/JavaScriptContextHolder;
public fun getNativeMethodCallInvokerHolder ()Lcom/facebook/react/internal/turbomodule/core/NativeMethodCallInvokerHolderImpl;
public synthetic fun getNativeMethodCallInvokerHolder ()Lcom/facebook/react/internal/turbomodule/core/interfaces/NativeMethodCallInvokerHolder;
public fun getNativeMethodCallInvokerHolder ()Lcom/facebook/react/turbomodule/core/NativeMethodCallInvokerHolderImpl;
public synthetic fun getNativeMethodCallInvokerHolder ()Lcom/facebook/react/turbomodule/core/interfaces/NativeMethodCallInvokerHolder;
public fun getNativeModule (Ljava/lang/Class;)Lcom/facebook/react/bridge/NativeModule;
public fun getNativeModule (Ljava/lang/String;)Lcom/facebook/react/bridge/NativeModule;
public fun getNativeModules ()Ljava/util/Collection;
Expand Down Expand Up @@ -3820,6 +3820,18 @@ public abstract interface class com/facebook/react/touch/ReactInterceptingViewGr
public abstract fun setOnInterceptTouchEventListener (Lcom/facebook/react/touch/OnInterceptTouchEventListener;)V
}

public class com/facebook/react/turbomodule/core/CallInvokerHolderImpl : com/facebook/react/turbomodule/core/interfaces/CallInvokerHolder {
}

public class com/facebook/react/turbomodule/core/NativeMethodCallInvokerHolderImpl : com/facebook/react/turbomodule/core/interfaces/NativeMethodCallInvokerHolder {
}

public abstract interface class com/facebook/react/turbomodule/core/interfaces/CallInvokerHolder {
}

public abstract interface class com/facebook/react/turbomodule/core/interfaces/NativeMethodCallInvokerHolder {
}

public abstract interface class com/facebook/react/turbomodule/core/interfaces/TurboModule : com/facebook/react/internal/turbomodule/core/interfaces/TurboModule {
}

Expand Down
1 change: 1 addition & 0 deletions packages/react-native/ReactAndroid/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

-dontwarn com.facebook.react.**
-keep,includedescriptorclasses class com.facebook.react.bridge.** { *; }
-keep,includedescriptorclasses class com.facebook.react.turbomodule.core.** { *; }
-keep,includedescriptorclasses class com.facebook.react.internal.turbomodule.core.** { *; }

# hermes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import com.facebook.react.bridge.queue.ReactQueueConfiguration;
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.internal.turbomodule.core.interfaces.CallInvokerHolder;
import com.facebook.react.internal.turbomodule.core.interfaces.NativeMethodCallInvokerHolder;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModuleRegistry;
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
import com.facebook.react.turbomodule.core.interfaces.NativeMethodCallInvokerHolder;
import java.util.Collection;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import com.facebook.react.common.ReactConstants;
import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.internal.turbomodule.core.CallInvokerHolderImpl;
import com.facebook.react.internal.turbomodule.core.NativeMethodCallInvokerHolderImpl;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModuleRegistry;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;
import com.facebook.react.turbomodule.core.NativeMethodCallInvokerHolderImpl;
import com.facebook.systrace.Systrace;
import com.facebook.systrace.TraceListener;
import java.lang.ref.WeakReference;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
import com.facebook.react.bridge.ReactNoCrashSoftException;
import com.facebook.react.bridge.ReactSoftExceptionLogger;
import com.facebook.react.bridge.RuntimeExecutor;
import com.facebook.react.internal.turbomodule.core.interfaces.CallInvokerHolder;
import com.facebook.react.internal.turbomodule.core.interfaces.NativeMethodCallInvokerHolder;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModuleRegistry;
import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;
import com.facebook.react.turbomodule.core.NativeMethodCallInvokerHolderImpl;
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
import com.facebook.react.turbomodule.core.interfaces.NativeMethodCallInvokerHolder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
import com.facebook.react.fabric.events.EventBeatManager;
import com.facebook.react.interfaces.exceptionmanager.ReactJsExceptionHandler;
import com.facebook.react.internal.AndroidChoreographerProvider;
import com.facebook.react.internal.turbomodule.core.CallInvokerHolderImpl;
import com.facebook.react.internal.turbomodule.core.NativeMethodCallInvokerHolderImpl;
import com.facebook.react.internal.turbomodule.core.TurboModuleManager;
import com.facebook.react.internal.turbomodule.core.TurboModuleManagerDelegate;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.modules.core.JavaTimerManager;
import com.facebook.react.modules.core.ReactChoreographer;
import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;
import com.facebook.react.turbomodule.core.NativeMethodCallInvokerHolderImpl;
import com.facebook.react.uimanager.ComponentNameResolver;
import com.facebook.react.uimanager.ComponentNameResolverManager;
import com.facebook.react.uimanager.DisplayMetricsHolder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.internal.turbomodule.core;
package com.facebook.react.turbomodule.core;

import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.internal.turbomodule.core.interfaces.CallInvokerHolder;
import com.facebook.react.internal.turbomodule.core.NativeModuleSoLoader;
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;

/**
* JSCallInvoker is created at a different time/place (i.e: in CatalystInstance) than
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.internal.turbomodule.core;
package com.facebook.react.turbomodule.core;

import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.internal.turbomodule.core.interfaces.NativeMethodCallInvokerHolder;
import com.facebook.react.internal.turbomodule.core.NativeModuleSoLoader;
import com.facebook.react.turbomodule.core.interfaces.NativeMethodCallInvokerHolder;

/**
* NativeMethodCallInvokerHolder is created at a different time/place (i.e: in CatalystInstance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.internal.turbomodule.core.interfaces
package com.facebook.react.turbomodule.core.interfaces
/**
* JS CallInvoker is created by CatalystInstance.cpp, but used by TurboModuleManager.cpp. Both C++
* classes are instantiated at different times/places. Therefore, to pass the JS CallInvoker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.internal.turbomodule.core.interfaces
package com.facebook.react.turbomodule.core.interfaces
/**
* This interface represents the opaque Java object that contains a pointer to and instance of
* NativeMethodCallInvoker.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace facebook::react {
class CallInvokerHolder : public jni::HybridClass<CallInvokerHolder> {
public:
static auto constexpr kJavaDescriptor =
"Lcom/facebook/react/internal/turbomodule/core/CallInvokerHolderImpl;";
"Lcom/facebook/react/turbomodule/core/CallInvokerHolderImpl;";

static void registerNatives();
std::shared_ptr<CallInvoker> getCallInvoker();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class NativeMethodCallInvokerHolder
: public jni::HybridClass<NativeMethodCallInvokerHolder> {
public:
static auto constexpr kJavaDescriptor =
"Lcom/facebook/react/internal/turbomodule/core/NativeMethodCallInvokerHolderImpl;";
"Lcom/facebook/react/turbomodule/core/NativeMethodCallInvokerHolderImpl;";

static void registerNatives();
std::shared_ptr<NativeMethodCallInvoker> getNativeMethodCallInvoker();
Expand Down

0 comments on commit fd0ca4d

Please sign in to comment.