android icon indicating copy to clipboard operation
android copied to clipboard

If you create a custom activity more than once an exception should be thrown

Open vhristov5555 opened this issue 5 years ago • 0 comments

  1. Create new project
  2. Try to extend the com.tns.NativeScriptActivity, which is create by tns-core-modules Code:
var MyCustomActivityClass = (function (_super) {
    __extends(MyCustomActivityClass, _super);
    function MyCustomActivityClass() {
        _super.call(this);
        return global.__native(this);
    }
    MyCustomActivityClass.prototype.onCreate = function (savedInstanceState) {
     	_super.prototype.onCreate.call(this, false ? savedInstanceState : null);
     	android.util.Log.d("Sbg.Test","we got called from onCreate of custom-activity.js");
    };

    MyCustomActivityClass = __decorate([
        JavaProxy("com.tns.NativeScriptActivity")
    ], MyCustomActivityClass);

    return MyCustomActivityClass;
}(android.app.Activity));

  1. Build the app for android tns build android Actual: A warning will be logged "Warning: there already is an extend called com.tns.NativeScriptActivity." Expected: An exception to be thrown https://github.com/NativeScript/android-runtime/blob/2ab7271d12d56a03e57880a2b1783b08206363ae/test-app/build-tools/static-binding-generator/src/main/java/org/nativescript/staticbindinggenerator/Generator.java#L82

P.S. In some cases the exception is thrown, but this situations are very rare.

vhristov5555 avatar Mar 19 '19 12:03 vhristov5555