René's URL Explorer Experiment


Title: fix: load prebuilt classes for anonymous extends by edusperoni · Pull Request #2101 · NativeScript/android · GitHub

Open Graph Title: fix: load prebuilt classes for anonymous extends by edusperoni · Pull Request #2101 · NativeScript/android

X Title: fix: load prebuilt classes for anonymous extends by edusperoni · Pull Request #2101 · NativeScript/android

Description: Description Every app built with 9.0+ generates its anonymous extend and @NativeClass classes on the device at startup, even though the static binding generator (SBG) already built them into the APK. On 9.1.x this happens on every launch. Bug 1: names don't match (since 9.0.0, #1836). The SBG names these classes _____, e.g. Object_vendor_7c3613_2_472138_ClickListenerImpl. The runtime only used the last path part (Object_vendor_2_472138_ClickListenerImpl), so DexFactory never found the prebuilt class and generated one with asmdex. Those classes are also not AOT-compiled. Bug 2: the dex cache never hits (since 9.1.0, #1965). DexFactory.getDexFile looks for --.dex, but generateDex called the generateProxy overload without the digest, so the file was written as -.dex. Every launch regenerated every class. Changes ExtendFileIdentifier builds the file part of the name exactly like Generator.generateUniqueFileIdentifier and es5-visitors.js do (same separators, Java split semantics, MD5, identifier normalization). I checked it against the generator's Java code on 15 paths, including vendor, tests/tests, scoped node_modules paths, spaces, $, and leading/trailing/double underscores. The CommonJS column offset on line 1 is no longer applied to ES modules (.mjs or HTTP-loaded), which have no wrapper. Before, an extend on line 1 of an .mjs file got a negative column (..._1_-13_). generateDex passes the content digest through, so runtime-generated classes (extends the SBG can't see) are reused across launches. es5-visitors.js finds the _super.apply call in the return statement of a constructor-less class. DexFactory.resolveClass tries the class name as given before the $→_ form. The generator keeps a $ from the file name, and the runtime already replaces the base class's $. Impact. I measured a drawer-navigation template app with a ListView on a Galaxy S20 FE (release build, optimized runtime, 4 interleaved rounds of 9–10 cold starts): Cold start (median) main 538 ms this PR 506–509 ms (−30 ms, −6%) In simpleperf, main-thread time under DexFactory.resolveClass drops from ~30 ms to 2 ms (loading the prebuilt classes), and generateDex disappears. Low-end devices should gain proportionally more. Bug 3: native classes without a constructor have no location in the SBG. TypeScript compiles them to return _super !== null && _super.apply(this, arguments) || this;. The SBG only recognized var _this = _super.call(this) || this;, so it emitted these classes with an empty line and column, and they were generated at runtime too. In the template app that was 3 of 117 bindings. The SBG now also recognizes the return form, readable and minified. The one binding still without a location in the template app is core's SnapshotViewGroup: terser drops the return at the end of its IIFE because the class is never used, so it never needs a class. Test fix: TestCanParseSignatureWithTypesThatContainsCapitalLettersForPrimitiveTypes failed on devices whose locale uses , as the decimal separator (pt-BR, for example). It now parses with Locale.US; what it tests, the NumberFormat[] signature, is unchanged. Does your commit message include the wording below to reference a specific issue in this repo? No issue. Related Pull Requests #1836 added the MD5 file identifier to the SBG. #1965 added the content digest to the dex cache key. Does your pull request have unit tests? Yes. testPrebuiltExtendClasses.js (plus an .mjs helper) covers six cases: An anonymous extend, TypeScript-compiled classes with and without a constructor, an extend on line 1 of an ES module, and an extend in a file with $ in its name each leave no runtime-generated dex. A class hidden from the SBG is cached under the --.dex name that DexFactory looks up. The naming, ES-module and cache specs failed on main. The constructor-less shape also generated at runtime before the SBG change. A new SBG parser case, extends_ts_no_constructor, checks the line and column of a readable and a minified constructor-less class. Parser tests: 9 specs, 0 failures. Full suite on a Galaxy S20 FE (pt-BR locale): 1533 specs, 0 failures. Summary by CodeRabbit Bug Fixes Improved support for Java class extensions across ES modules, CommonJS modules, and TypeScript-compiled classes, including classes without explicit constructors. Improved loading of pre-generated classes when class names or source file names contain special characters. Improved source location reporting for extended classes across module types. Generated class files now use consistent identifiers based on their source paths, and generated proxy files incorporate content digests to distinguish files when source content changes.

Open Graph Description: Description Every app built with 9.0+ generates its anonymous extend and @NativeClass classes on the device at startup, even though the static binding generator (SBG) already built them into the AP...

X Description: Description Every app built with 9.0+ generates its anonymous extend and @NativeClass classes on the device at startup, even though the static binding generator (SBG) already built them into the AP...

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

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:79a7b19c-3692-6227-88a2-e7c736faff60
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCE5C:13C1CF:28999:375D3:6B015AD4
html-safe-nonce3c8122f2db26376d06eee2d0d21efb4a040d9405ff601c9f4e05f99f2f8c3346
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTVDOjEzQzFDRjoyODk5OTozNzVEMzo2QjAxNUFENCIsInZpc2l0b3JfaWQiOiIyNzUwMjc2ODU1MTgwMzg0OTgwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac08493731b59337d364fb1aafa84537f492219b8236e80d510350c43a84d9a95b
hovercard-subject-tagpull_request:5253187285
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/2101/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 Every app built with 9.0+ generates its anonymous extend and @NativeClass classes on the device at startup, even though the static binding generator (SBG) already built them into the AP...
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/2101/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fandroid%2Fpull%2F2101%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%2F2101%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/2101/files
Reloadhttps://github.com/NativeScript/android/pull/2101/files
Reloadhttps://github.com/NativeScript/android/pull/2101/files
NativeScripthttps://github.com/NativeScript
androidhttps://github.com/NativeScript/android
Codehttps://github.com/NativeScript/android
Issues106 (106)https://github.com/NativeScript/android/issues
Pull requests26 (26)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
mainhttps://github.com/NativeScript/android/tree/main
fix/extend-class-nameshttps://github.com/NativeScript/android/tree/fix/extend-class-names
Conversation 5 https://github.com/NativeScript/android/pull/2101
Commits 4 https://github.com/NativeScript/android/pull/2101/commits
Checks 8 https://github.com/NativeScript/android/pull/2101/checks
Files changed https://github.com/NativeScript/android/pull/2101/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2101/files
fix: load prebuilt classes for anonymous extends https://github.com/NativeScript/android/pull/2101/files#top
Show all changes 4 commits https://github.com/NativeScript/android/pull/2101/files
5701546 fix: load prebuilt classes for anonymous extends edusperoni Nov 11, 2026 https://github.com/NativeScript/android/pull/2101/commits/570154651e417d92b46a20538c5756499ef9af23
cf75485 fix: locate the super call of native classes without a constructor edusperoni Nov 11, 2026 https://github.com/NativeScript/android/pull/2101/commits/cf754854555d69b8526da2a247ca1e818443cfd2
ec974aa test: parse MessageFormat numbers in a fixed locale edusperoni Nov 11, 2026 https://github.com/NativeScript/android/pull/2101/commits/ec974aa3d2950309dbf0d7745264e67367c62f55
7613f2b fix: keep $ from the file name when loading a prebuilt class edusperoni Nov 11, 2026 https://github.com/NativeScript/android/pull/2101/commits/7613f2b023c877ad786b1c5dd474c5d45077b574
Clear filters https://github.com/NativeScript/android/pull/2101/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2101/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2101/files
mainpage.js https://github.com/NativeScript/android/pull/2101/files#diff-b7fd6c22bfc29391e9e3ed935d6c6194b1ad595c7592690229952b5ddb99c0d5
prebuiltExtend$Dollar.js https://github.com/NativeScript/android/pull/2101/files#diff-bb4b8174bbf328ee549843fa56c3b8e25646876e4439d27036de7568058e5524
prebuiltExtendLineOne.mjs https://github.com/NativeScript/android/pull/2101/files#diff-5f82ff5e8d1015962c52595ca475678c072e371ca8d2140b7b67d46e8d416efe
testPrebuiltExtendClasses.js https://github.com/NativeScript/android/pull/2101/files#diff-4f3700b439965d816d5b74b882b1a06118a7e4890602d140c471f14205b76a58
tests.js https://github.com/NativeScript/android/pull/2101/files#diff-85a0d1a29d0d9164459053d1a16a852c1e0539ca7b06283b6d6a932d280553b5
no_constructor.js https://github.com/NativeScript/android/pull/2101/files#diff-a2c61ba5710474a835e404f4d749d7227acca836a34151b4ee015d85fb1789b2
ts_helpers.js https://github.com/NativeScript/android/pull/2101/files#diff-c1b36c2a91095a99dfb097df38f80658e06c503baaf1aed64e52ba21dfc6cbde
ast-parser-tests.spec.js https://github.com/NativeScript/android/pull/2101/files#diff-2b30fef9bfe0c9604cb8f53be605ed604b9c950bcefbdb14214a7c12d5683a38
es5-visitors.js https://github.com/NativeScript/android/pull/2101/files#diff-1e4279e8da356183e4b0aa5190b56148542110e92f0c6587cd6ca5f502ac196c
CMakeLists.txt https://github.com/NativeScript/android/pull/2101/files#diff-9aa48152a82c07a60ab6e09923a9b266e2985f78e579653848df730cd8ec5e4c
ExtendFileIdentifier.cpp https://github.com/NativeScript/android/pull/2101/files#diff-fe38eb8f0dd1417c0debf1cb6c4199ae7f3dfd85ffd0336c22563ce47a5672b4
ExtendFileIdentifier.h https://github.com/NativeScript/android/pull/2101/files#diff-ebb04a0d7bf30df1128fa430747b968c33d8e84db21e3e8003f93fdd9f26cc87
MetadataNode.cpp https://github.com/NativeScript/android/pull/2101/files#diff-6f6c5b64f60875e24b75b8a21b3164f114822aa7e5add5755f072f36403f7f8b
DexFactory.java https://github.com/NativeScript/android/pull/2101/files#diff-7f8ef213b415ed89638d410cdc1813a95a7aafb2b6ae962e4862099ae1a8f95d
test-app/app/src/main/assets/app/mainpage.jshttps://github.com/NativeScript/android/pull/2101/files#diff-b7fd6c22bfc29391e9e3ed935d6c6194b1ad595c7592690229952b5ddb99c0d5
View file https://github.com/NativeScript/android/blob/7613f2b023c877ad786b1c5dd474c5d45077b574/test-app/app/src/main/assets/app/mainpage.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2101/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2101/files#diff-b7fd6c22bfc29391e9e3ed935d6c6194b1ad595c7592690229952b5ddb99c0d5
https://github.com/NativeScript/android/pull/2101/files#diff-b7fd6c22bfc29391e9e3ed935d6c6194b1ad595c7592690229952b5ddb99c0d5
test-app/app/src/main/assets/app/tests/prebuiltExtend$Dollar.jshttps://github.com/NativeScript/android/pull/2101/files#diff-bb4b8174bbf328ee549843fa56c3b8e25646876e4439d27036de7568058e5524
View file https://github.com/NativeScript/android/blob/7613f2b023c877ad786b1c5dd474c5d45077b574/test-app/app/src/main/assets/app/tests/prebuiltExtend%24Dollar.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2101/{{ revealButtonHref }}
test-app/app/src/main/assets/app/tests/prebuiltExtendLineOne.mjshttps://github.com/NativeScript/android/pull/2101/files#diff-5f82ff5e8d1015962c52595ca475678c072e371ca8d2140b7b67d46e8d416efe
View file https://github.com/NativeScript/android/blob/7613f2b023c877ad786b1c5dd474c5d45077b574/test-app/app/src/main/assets/app/tests/prebuiltExtendLineOne.mjs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2101/{{ revealButtonHref }}
test-app/app/src/main/assets/app/tests/testPrebuiltExtendClasses.jshttps://github.com/NativeScript/android/pull/2101/files#diff-4f3700b439965d816d5b74b882b1a06118a7e4890602d140c471f14205b76a58
View file https://github.com/NativeScript/android/blob/7613f2b023c877ad786b1c5dd474c5d45077b574/test-app/app/src/main/assets/app/tests/testPrebuiltExtendClasses.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2101/{{ revealButtonHref }}
test-app/app/src/main/assets/app/tests/tests.jshttps://github.com/NativeScript/android/pull/2101/files#diff-85a0d1a29d0d9164459053d1a16a852c1e0539ca7b06283b6d6a932d280553b5
View file https://github.com/NativeScript/android/blob/7613f2b023c877ad786b1c5dd474c5d45077b574/test-app/app/src/main/assets/app/tests/tests.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2101/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2101/files#diff-85a0d1a29d0d9164459053d1a16a852c1e0539ca7b06283b6d6a932d280553b5
https://github.com/NativeScript/android/pull/2101/files#diff-85a0d1a29d0d9164459053d1a16a852c1e0539ca7b06283b6d6a932d280553b5
test-app/build-tools/jsparser/tests/cases/extends_ts_no_constructor/app/no_constructor.jshttps://github.com/NativeScript/android/pull/2101/files#diff-a2c61ba5710474a835e404f4d749d7227acca836a34151b4ee015d85fb1789b2
View file https://github.com/NativeScript/android/blob/7613f2b023c877ad786b1c5dd474c5d45077b574/test-app/build-tools/jsparser/tests/cases/extends_ts_no_constructor/app/no_constructor.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2101/{{ revealButtonHref }}
test-app/build-tools/jsparser/tests/cases/extends_ts_no_constructor/internal/ts_helpers.jshttps://github.com/NativeScript/android/pull/2101/files#diff-c1b36c2a91095a99dfb097df38f80658e06c503baaf1aed64e52ba21dfc6cbde
View file https://github.com/NativeScript/android/blob/7613f2b023c877ad786b1c5dd474c5d45077b574/test-app/build-tools/jsparser/tests/cases/extends_ts_no_constructor/internal/ts_helpers.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2101/{{ revealButtonHref }}
test-app/build-tools/jsparser/tests/specs/ast-parser-tests.spec.jshttps://github.com/NativeScript/android/pull/2101/files#diff-2b30fef9bfe0c9604cb8f53be605ed604b9c950bcefbdb14214a7c12d5683a38
View file https://github.com/NativeScript/android/blob/7613f2b023c877ad786b1c5dd474c5d45077b574/test-app/build-tools/jsparser/tests/specs/ast-parser-tests.spec.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2101/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2101/files#diff-2b30fef9bfe0c9604cb8f53be605ed604b9c950bcefbdb14214a7c12d5683a38
https://github.com/NativeScript/android/pull/2101/files#diff-2b30fef9bfe0c9604cb8f53be605ed604b9c950bcefbdb14214a7c12d5683a38
Please reload this pagehttps://github.com/NativeScript/android/pull/2101/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2101/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.