René's URL Explorer Experiment


Title: fix: convert callback results the return type can hold by edusperoni · Pull Request #2097 · NativeScript/android · GitHub

Open Graph Title: fix: convert callback results the return type can hold by edusperoni · Pull Request #2097 · NativeScript/android

X Title: fix: convert callback results the return type can hold by edusperoni · Pull Request #2097 · NativeScript/android

Description: Description Stacked on #2096 (base perf/primitive-callback-returns). That PR added a spec pinning how a JS callback's result converts to each primitive return type, and the spec exposed real crashes, fixed here. A callback result only reached Java when the generic converter happened to produce exactly the declared wrapper type, which is all the generated binding's cast accepts. So these all threw ClassCastException, a crash when it happens on an Android callback: a double callback returning a whole number (return 1); a float callback returning a negative or whole number; a byte/short callback returning any plain number; a char callback returning a string. New rule: a result converts whenever the declared type can hold it. Return type Accepted byte / short / int / long whole numbers in the type's range float 0, NaN, ±Infinity, or a magnitude within float range double any number char a one-character string boolean booleans, and Boolean objects by their value Number objects follow the same rules as numbers. Values the type can't hold still throw, matching the deliberate specs in numericConversionTests.js (an out-of-range long for int, 1e-40 for float): non-whole or out-of-range numbers for integer types; float underflow or overflow; strings for numeric types; numbers for boolean/char. null/undefined/{} still become the default value, and cast markers behave as before. Behavior changes: 35 cells of the 33×8 matrix go from throwing to a value, and one value changes: new Boolean(false) returned true and now returns false. Nothing that converted before now throws. Every changed cell JS value return type before after 0 byte throws ClassCastException 0 0 short throws ClassCastException 0 0 float throws ClassCastException 0.0 0 double throws ClassCastException 0.0 1 byte throws ClassCastException 1 1 short throws ClassCastException 1 1 float throws ClassCastException 1.0 1 double throws ClassCastException 1.0 -1 byte throws ClassCastException -1 -1 short throws ClassCastException -1 -1 float throws ClassCastException -1.0 -1 double throws ClassCastException -1.0 -0 byte throws ClassCastException 0 -0 short throws ClassCastException 0 -0 float throws ClassCastException -0.0 -0 double throws ClassCastException -0.0 2^31 float throws ClassCastException 2.1474836E9 2^31 double throws ClassCastException 2.147483648E9 -2^31-1 float throws ClassCastException -2.1474836E9 -2^31-1 double throws ClassCastException -2.147483649E9 2^40 float throws ClassCastException 1.0995116E12 2^40 double throws ClassCastException 1.099511627776E12 2^60 float throws ClassCastException 1.1529215E18 2^60 double throws ClassCastException 1.152921504606847E18 -1.5 float throws ClassCastException -1.5 NaN float throws ClassCastException NaN Infinity float throws ClassCastException Infinity -Infinity float throws ClassCastException -Infinity -2.5 float throws ClassCastException -2.5 '1' char throws ClassCastException 49 'a' char throws ClassCastException 97 Number(5) byte throws ClassCastException 5 Number(5) short throws ClassCastException 5 Number(5) float throws ClassCastException 5.0 Number(5) double throws ClassCastException 5.0 Boolean(false) boolean true false Does your pull request have unit tests? Yes. testPrimitiveCallbackReturns.js is updated to the new matrix. numericConversionTests.js is unchanged and still passes, including its exception cases. Full suite: 1484 specs, 0 failures. Summary by CodeRabbit New Features JavaScript callbacks now support more return-value conversions for Java primitive types, including booleans, characters, and numeric values. Primitive and boxed values are handled where supported, with range and format checks applied to integral returns. Float and double results now preserve clearer formatting for special values and decimal precision.

Open Graph Description: Description Stacked on #2096 (base perf/primitive-callback-returns). That PR added a spec pinning how a JS callback's result converts to each primitive return type, and the spec exposed real cr...

X Description: Description Stacked on #2096 (base perf/primitive-callback-returns). That PR added a spec pinning how a JS callback's result converts to each primitive return type, and the spec exposed rea...

Opengraph URL: https://github.com/NativeScript/android/pull/2097

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:3c32b1ae-efe8-c75a-d47b-3c44e0f0aa1b
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8896:25598F:169696E:1DCFFAB:6B01347C
html-safe-nonce8abf7ec29a4a4dee56f9cb7b318296eaae3bf2c481e21da100e6b9db4caee4aa
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODk2OjI1NTk4RjoxNjk2OTZFOjFEQ0ZGQUI6NkIwMTM0N0MiLCJ2aXNpdG9yX2lkIjoiNzQzODY3NzM4NDcyMDYyNjgxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac97d68dac767c5537daf07e06628c592f64c1efbb9aee77fde6b020cb774a37a6
hovercard-subject-tagpull_request:5215192664
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/NativeScript/android/pull/2097/files
twitter:imagehttps://avatars.githubusercontent.com/u/4061767?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/4061767?s=400&v=4
og:image:altDescription Stacked on #2096 (base perf/primitive-callback-returns). That PR added a spec pinning how a JS callback's result converts to each primitive return type, and the spec exposed real cr...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/NativeScript/android git https://github.com/NativeScript/android.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id29137950
octolytics-dimension-repository_nwoNativeScript/android
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id29137950
octolytics-dimension-repository_network_root_nwoNativeScript/android
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/NativeScript/android/pull/2097/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fandroid%2Fpull%2F2097%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fandroid%2Fpull%2F2097%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=NativeScript%2Fandroid
Reloadhttps://github.com/NativeScript/android/pull/2097/files
Reloadhttps://github.com/NativeScript/android/pull/2097/files
Reloadhttps://github.com/NativeScript/android/pull/2097/files
NativeScripthttps://github.com/NativeScript
androidhttps://github.com/NativeScript/android
Codehttps://github.com/NativeScript/android
Issues106 (106)https://github.com/NativeScript/android/issues
Pull requests24 (24)https://github.com/NativeScript/android/pulls
Actionshttps://github.com/NativeScript/android/actions
Projectshttps://github.com/NativeScript/android/projects
Wikihttps://github.com/NativeScript/android/wiki
Security and qualityhttps://github.com/NativeScript/android/security
Insightshttps://github.com/NativeScript/android/insights
Sign up for GitHub https://github.com/signup?return_to=%2FNativeScript%2Fandroid%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FNativeScript%2Fandroid%2Fissues%2Fnew%2Fchoose
edusperonihttps://github.com/edusperoni
perf/primitive-callback-returnshttps://github.com/NativeScript/android/tree/perf/primitive-callback-returns
fix/primitive-callback-return-conversionhttps://github.com/NativeScript/android/tree/fix/primitive-callback-return-conversion
Conversation 1 https://github.com/NativeScript/android/pull/2097
Commits 2 https://github.com/NativeScript/android/pull/2097/commits
Checks 8 https://github.com/NativeScript/android/pull/2097/checks
Files changed https://github.com/NativeScript/android/pull/2097/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2097/files
fix: convert callback results the return type can hold https://github.com/NativeScript/android/pull/2097/files#top
Show all changes 2 commits https://github.com/NativeScript/android/pull/2097/files
074c27c fix: convert JS callback results that the primitive return type can hold edusperoni Nov 8, 2026 https://github.com/NativeScript/android/pull/2097/commits/074c27c911def4f40453f0381f332b2d7e52538f
bf0f0b6 test: format float/double callback results the same on every Android … edusperoni Nov 8, 2026 https://github.com/NativeScript/android/pull/2097/commits/bf0f0b6b0649675bd13602b066b6252198056da4
Clear filters https://github.com/NativeScript/android/pull/2097/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2097/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2097/files
testPrimitiveCallbackReturns.js https://github.com/NativeScript/android/pull/2097/files#diff-98e5d885b87eae0543fa4f13f933b915112dd0cfa9a527b81832fb279c71b625
PrimitiveReturnTest.java https://github.com/NativeScript/android/pull/2097/files#diff-0e160fce632b24e0e81ebe7d4b333a6dab5cc6e0c494a1458fda3ffde54b192e
Runtime.cpp https://github.com/NativeScript/android/pull/2097/files#diff-b9490640f5d26f7cd6b9a176a2142b8e985a6aac9e2d64287de37fc694e80cc3
Runtime.java https://github.com/NativeScript/android/pull/2097/files#diff-cf9bb4e9ca1a476cacd6e270fc8bcd12c71f89d52d272915bc99df57b3581f59
test-app/app/src/main/assets/app/tests/testPrimitiveCallbackReturns.jshttps://github.com/NativeScript/android/pull/2097/files#diff-98e5d885b87eae0543fa4f13f933b915112dd0cfa9a527b81832fb279c71b625
View file https://github.com/NativeScript/android/blob/bf0f0b6b0649675bd13602b066b6252198056da4/test-app/app/src/main/assets/app/tests/testPrimitiveCallbackReturns.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2097/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2097/files#diff-98e5d885b87eae0543fa4f13f933b915112dd0cfa9a527b81832fb279c71b625
https://github.com/NativeScript/android/pull/2097/files#diff-98e5d885b87eae0543fa4f13f933b915112dd0cfa9a527b81832fb279c71b625
test-app/app/src/main/java/com/tns/tests/PrimitiveReturnTest.javahttps://github.com/NativeScript/android/pull/2097/files#diff-0e160fce632b24e0e81ebe7d4b333a6dab5cc6e0c494a1458fda3ffde54b192e
View file https://github.com/NativeScript/android/blob/bf0f0b6b0649675bd13602b066b6252198056da4/test-app/app/src/main/java/com/tns/tests/PrimitiveReturnTest.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2097/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2097/files#diff-0e160fce632b24e0e81ebe7d4b333a6dab5cc6e0c494a1458fda3ffde54b192e
https://github.com/NativeScript/android/pull/2097/files#diff-0e160fce632b24e0e81ebe7d4b333a6dab5cc6e0c494a1458fda3ffde54b192e
https://github.com/NativeScript/android/pull/2097/files#diff-0e160fce632b24e0e81ebe7d4b333a6dab5cc6e0c494a1458fda3ffde54b192e
test-app/runtime/src/main/cpp/Runtime.cpphttps://github.com/NativeScript/android/pull/2097/files#diff-b9490640f5d26f7cd6b9a176a2142b8e985a6aac9e2d64287de37fc694e80cc3
View file https://github.com/NativeScript/android/blob/bf0f0b6b0649675bd13602b066b6252198056da4/test-app/runtime/src/main/cpp/Runtime.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2097/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2097/files#diff-b9490640f5d26f7cd6b9a176a2142b8e985a6aac9e2d64287de37fc694e80cc3
https://github.com/NativeScript/android/pull/2097/files#diff-b9490640f5d26f7cd6b9a176a2142b8e985a6aac9e2d64287de37fc694e80cc3
https://github.com/NativeScript/android/pull/2097/files#diff-b9490640f5d26f7cd6b9a176a2142b8e985a6aac9e2d64287de37fc694e80cc3
https://github.com/NativeScript/android/pull/2097/files#diff-b9490640f5d26f7cd6b9a176a2142b8e985a6aac9e2d64287de37fc694e80cc3
https://github.com/NativeScript/android/pull/2097/files#diff-b9490640f5d26f7cd6b9a176a2142b8e985a6aac9e2d64287de37fc694e80cc3
test-app/runtime/src/main/java/com/tns/Runtime.javahttps://github.com/NativeScript/android/pull/2097/files#diff-cf9bb4e9ca1a476cacd6e270fc8bcd12c71f89d52d272915bc99df57b3581f59
View file https://github.com/NativeScript/android/blob/bf0f0b6b0649675bd13602b066b6252198056da4/test-app/runtime/src/main/java/com/tns/Runtime.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2097/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2097/files#diff-cf9bb4e9ca1a476cacd6e270fc8bcd12c71f89d52d272915bc99df57b3581f59
https://github.com/NativeScript/android/pull/2097/files#diff-cf9bb4e9ca1a476cacd6e270fc8bcd12c71f89d52d272915bc99df57b3581f59
https://github.com/NativeScript/android/pull/2097/files#diff-cf9bb4e9ca1a476cacd6e270fc8bcd12c71f89d52d272915bc99df57b3581f59
Please reload this pagehttps://github.com/NativeScript/android/pull/2097/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.