You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Static binding generator creates wrong files, when two extended classes have the same name #692
Uglify is used and the names SwipeGestureListener and TapAndDoubleTapGestureListener become e or some other letter.
while we analyze the uglified, minified javascript the AST parser generates the same name for both classes: GestureDetector_SimpleOnGestureListener_frnal_ts_helpers_l58_c38__e.java.
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.
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.
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.
Activity
Plamen5kov commentedon Jan 18, 2017
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.
added message if two classes will be generated with the same name
added message if two classes will be generated with the same name
madakk commentedon 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 commentedon Jan 26, 2018
@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 commentedon Jan 26, 2018
That's great news, thanks!
Natalia-Hristova commentedon Feb 19, 2018
Remove RfT label beacuse the fix is reverted.
Natalia-Hristova commentedon Mar 13, 2018
This is fixed and will be available in the next official release of
tns-android.