Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static binding generator creates wrong files, when two extended classes have the same name #692

Closed
Plamen5kov opened this issue Jan 18, 2017 · 6 comments
Assignees
Milestone

Comments

@Plamen5kov
Copy link
Contributor

Problem:
Static binding generator creates wrong files, when two extended classes have the same name
How can I reproduce the problem:

The name is generated as follows:
<extended_class_name>_f<file_path>_l<line>_c<column>__<unique_name>.java

  • Because both classes extend the same base class, both names start with the same <extended_class_name>
  • Because the typescript extends all pass through the ts_helpers file, all files have the same _f<file_path>_l<line>_c<column>.
  • Because uglifyer minifies the names of both classes the <unique_name> is not so unique anymore.

Solution
There are two general paths we can take:

  • Suggest the user makes an exception when uglifying for the <unique_name> so it stays unique
  • Find a different way to generate names, that will generate classes with different names, that's also compatible with the way the runtime binding generator would generate them.

This problem does not happen when extending an interface, because the native implementation name does not take part in finding the js counterpart implementation, and all can use the same implementation of an interface.

@Plamen5kov Plamen5kov self-assigned this Jan 18, 2017
@Plamen5kov
Copy link
Contributor Author

For now we'll issue a warning the identical names will be created and that will cause an undefined behavior. In this case the build will crash and recommend workaround options.

Plamen5kov added a commit that referenced this issue Jan 19, 2017
this problem is explained in detail in issue #692
also did a clean of generated bindings
@Plamen5kov Plamen5kov added the bug label Jan 20, 2017
petekanev pushed a commit that referenced this issue Mar 20, 2017
this problem is explained in detail in issue #692
also did a clean of generated bindings
@Plamen5kov Plamen5kov removed their assignment Jul 24, 2017
@madakk
Copy link

madakk commented Aug 21, 2017

This is causing a problem even without uglifying, because the names have to be globally unique. That means if I use a name that's already been used somewhere in another module, I will hit the same issue because everything passes through the same line in ts_helpers.

@petekanev
Copy link
Contributor

@madakk I am happy to say that the problem will be addressed in the next major release of NativeScript.

Follow the progress at #923

@madakk
Copy link

madakk commented Jan 26, 2018

That's great news, thanks!

@Natalia-Hristova
Copy link

Remove RfT label beacuse the fix is reverted.

@Natalia-Hristova Natalia-Hristova added this to the 4.0.0 (TBD) milestone Feb 20, 2018
@Natalia-Hristova Natalia-Hristova self-assigned this Mar 13, 2018
@Natalia-Hristova Natalia-Hristova removed their assignment Mar 13, 2018
@Natalia-Hristova
Copy link

This is fixed and will be available in the next official release of tns-android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants