NativeScript / NativeScript/android

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

未关闭
#1,320 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
C++
星标
563
派生
144
平均合并
10 小时 46 分钟
30 天内合并 PR
14

描述

  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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从链接的 Generator.java 位置(约第 82 行)开始,跟踪如何处理 com.tns.NativeScriptActivity 的重复 extends。使用 tns build android 运行报告中的 custom-activity 重现;当重复扩展产生预期的 exception,而不只是记录警告时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, java, javascript
领域
build-system, mobile-dev
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
52/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。