Skip to content

fix(android): load prebuilt classes for constructor-less and dollar-named extends - #135

Open
ammarahm-ed wants to merge 3 commits into
perf/jni-11-upstream-2099from
fix/android-prebuilt-extend-classes
Open

ammarahm-ed wants to merge 3 commits into
perf/jni-11-upstream-2099from
fix/android-prebuilt-extend-classes

Conversation

@ammarahm-ed

Copy link
Copy Markdown
Collaborator

Ports the parts of NativeScript/android#2101 that apply to this tree, so more extend and @NativeClass classes are loaded from the APK instead of being generated on the device.

Changes

  • The static binding generator's parser now recognises return _super !== null && _super.apply(this, arguments) || this;, readable and minified, so a TypeScript class without a constructor gets a file, line and column instead of empty ones
  • DexFactory.resolveClass tries the class name as given before the $ → _ form, so a prebuilt class whose file name contains $ is found
  • The number-format signature spec parses with Locale.US so it passes on locales that use , as the decimal separator

Not ported

  • ExtendFileIdentifier and the md5 in the file name: this tree's generator names classes <Base>_<last path part>_<line>_<col>_<name>, which is what GetExtendLocation already produces in both runtimes, so there is no name mismatch
  • The content digest in generateDex: the cache key here is <name>-<thumb>.dex on both the write and the lookup side
  • The ES-module column offset change: neither runtime loads .mjs or HTTP modules

Before / after

The new jsparser case extends_ts_no_constructor fails without the change (the generated file name is no_constructor***Minified, with empty line and column) and passes with it: 13 jsparser specs, 0 failures.

The device specs in testPrebuiltExtendClasses.js pass with and without the DexFactory and parser changes on this test app (533 specs, 0 failures both ways), so they are regression guards, not proof of the fix. No cold-start numbers: the naming and cache fixes behind upstream's 6% do not apply here.

Tests

Jasmine suite on a Sony SO-01M with V8: Node-API 533 specs, 0 failures; direct 461 specs, 0 failures. Runtime Java unit tests pass. static-binding-generator GeneratorTest (ClassFormatError) and NodeJSProcessImplTest fail on the stack as well and are unchanged.

Expected locations in the new parser case are columns 64 and 108 because this parser reports the call's end column for this shape, as it already does for var _this = _super.call(this) || this.

Stacked on #134.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 47c628fd-f7c5-4cdb-a412-6410aec484b7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant