Remove JavaMethodWrapper and decouple JavaModuleWrapper from legacy invocation#56201
Open
mdvacca wants to merge 1 commit intofacebook:mainfrom
Open
Remove JavaMethodWrapper and decouple JavaModuleWrapper from legacy invocation#56201mdvacca wants to merge 1 commit intofacebook:mainfrom
mdvacca wants to merge 1 commit intofacebook:mainfrom
Conversation
…nvocation Summary: JavaMethodWrapper is a legacy architecture class that wraps ReactMethod-annotated Java methods via reflection for the bridge-based NativeModule invocation path. When ReactNativeFeatureFlags.useTurboModuleInterop is enabled (the new architecture), this class is completely bypassed — the TurboModule interop layer uses JavaInteropTurboModule (C++) with direct JNI invocation via JavaTurboModule::invokeJavaMethod(), which converts JSI values to JNI arguments directly in C++ without any Java-side reflection. This diff: - Deletes JavaMethodWrapper.kt (only instantiated from JavaModuleWrapper.findMethods()) - Deletes BaseJavaModuleTest.kt (test that exercised JavaMethodWrapper) - Removes the NativeMethod interface from JavaModuleWrapper (only implemented by JavaMethodWrapper) - Rewrites JavaModuleWrapper.findMethods() to compute method type inline without JavaMethodWrapper - Changes JavaModuleWrapper.invoke() to throw UnsupportedOperationException - Sets md.signature to empty string for sync methods to prevent C++ null deref The JavaModuleWrapper class shell is kept because it is still referenced from C++ JNI (JavaModuleWrapper.cpp) and NativeModuleRegistry. Full removal is planned as follow-up. Reviewed By: cortinico, javache Differential Revision: D97387121
cortinico
approved these changes
Mar 23, 2026
Contributor
cortinico
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
JavaMethodWrapper is a legacy architecture class that wraps ReactMethod-annotated
Java methods via reflection for the bridge-based NativeModule invocation path.
When ReactNativeFeatureFlags.useTurboModuleInterop is enabled (the new architecture),
this class is completely bypassed — the TurboModule interop layer uses
JavaInteropTurboModule (C++) with direct JNI invocation via
JavaTurboModule::invokeJavaMethod(), which converts JSI values to JNI arguments
directly in C++ without any Java-side reflection.
This diff:
The JavaModuleWrapper class shell is kept because it is still referenced from C++ JNI
(JavaModuleWrapper.cpp) and NativeModuleRegistry. Full removal is planned as follow-up.
Reviewed By: cortinico, javache
Differential Revision: D97387121