Skip to content

Commit

Permalink
fix: Mark Java HybridObjectRegistry as deprecated
Browse files Browse the repository at this point in the history
HybridObjects should be registered from C++ instead.
  • Loading branch information
mrousavy committed Jan 13, 2025
1 parent bbbeeaf commit 4d2b1fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct JHybridObjectRegistry : public jni::JavaClass<JHybridObjectRegistry> {
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/core/HybridObjectRegistry;";

public:
[[deprecated("HybridObjects should be registered from C++ instead. Either autolink them using `nitro.json`, or add them manually in HybridObjectRegistry.")]]
static void registerHybridObjectConstructor(jni::alias_ref<jni::JClass> clazz, std::string hybridObjectName,
jni::alias_ref<JHybridObjectInitializer> constructorFn);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class HybridObjectRegistry {
* Registers the given HybridObject in the `HybridObjectRegistry`.
* It will be uniquely identified via it's `hybridObjectName`, and can be initialized from
* JS using `NitroModules.createHybridObject<T>(name)` - which will call the `constructorFn` here.
* @deprecated HybridObjects should be registered from C++ instead. Either autolink them using `nitro.json`, or add them manually in HybridObjectRegistry.
*/
@Deprecated(forRemoval = true)
public static native void registerHybridObjectConstructor(String hybridObjectName, HybridObjectInitializer initializer);
}

0 comments on commit 4d2b1fe

Please sign in to comment.