Skip to content

Throw on unexpected return types for number TurboModule methods on Android - #60009

Merged
meta-codesync[bot] merged 1 commit into
react:mainfrom
r-barnes:export-D131835371
Nov 18, 2026
Merged

meta-codesync[bot] merged 1 commit into
react:mainfrom
r-barnes:export-D131835371

Conversation

@r-barnes

Copy link
Copy Markdown
Contributor

Summary:
In JavaTurboModule::invokeJavaMethod, the NumberKind case only handled boxed Double/Float/Integer and primitive D/F/I return types. Any other return type fell through into the StringKind case, which called the method as an object-returning method and converted the result as a string. Throw a std::runtime_error naming the method and its return type instead, matching how the default case reports an unknown method kind.

Changelog: [Android][Fixed] - Throw an error instead of treating the result as a string when a number TurboModule method has an unexpected return type

Differential Revision: D131835371

…droid

Summary:
In `JavaTurboModule::invokeJavaMethod`, the `NumberKind` case only handled boxed `Double`/`Float`/`Integer` and primitive `D`/`F`/`I` return types. Any other return type fell through into the `StringKind` case, which called the method as an object-returning method and converted the result as a string. Throw a `std::runtime_error` naming the method and its return type instead, matching how the `default` case reports an unknown method kind.

Changelog: [Android][Fixed] - Throw an error instead of treating the result as a string when a number TurboModule method has an unexpected return type

Differential Revision: D131835371
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 14, 2026
@meta-codesync

meta-codesync Bot commented Nov 14, 2026

Copy link
Copy Markdown

@r-barnes has exported this pull request. If you are a Meta employee, you can view the originating Diff in D131835371.

@javache javache left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesync
meta-codesync Bot merged commit 83e2029 into react:main Nov 18, 2026
101 checks passed
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @r-barnes in 83e2029

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants