Enable generation of default (0-arguments) constructor when extending classes
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 30/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- android, cpp, java, javascript
調査の方向性
この issue には JavaScript と Java の例がありますが、ソースファイル、テスト、エントリポイントは示されていません。まず、クラス拡張に対するコンストラクター生成の経路を特定してください。完了の条件は、引数なしコンストラクターを持たない基底クラスの拡張が、指定どおりに委譲する生成された引数なしコンストラクターを公開でき、示されたケースをカバーしていることです。
索引モデルが issue の本文から書いたものです。
説明
If the developer extends a base class with no default constructor, they have no way of explicitly specifying that they want a default constructor code to be generated in Java. This is a certain limitation if the class needs to be declared in the AndroidManifest and is instantiated by the system (attempting to use IntentService is one such case - Android will attempt to create an instance of the implementation of IntentService, but will crash, as it tries to invoke a default constructor, which the developer cannot declare).
Given the following Java class:
package a.b;
public class Base {
public Base(String a) { ... }
}
and the following implementation in JavaScript:
a.b.Base.extend("a.b.ExtendedBase", {
init: function() {
_this("arbitrary string");
// -> will introduce additional logic in the sole ctor block
// in Java, but will not create an additional constructor
}
});
will output
package a.b;
@com.tns.JavaScriptImplementation(javaScriptFile = "./ExtendedBase.js")
public class ExtendedBase extends a.b.Base implements com.tns.NativeScriptHashCodeProvider {
/* No default constructor */
public ExtendedBase (java.lang.String param_0){
super(param_0);
/*
Additional logic to handle more arguments -> a result of the init function
*/
com.tns.Runtime.initInstance(this);
}
public boolean equals__super(java.lang.Object other) {
return super.equals(other);
}
public int hashCode__super() {
return super.hashCode();
}
}
Developers have no way to declare a default constructor for a.b.ExtendedBase.
Instead what I need is
package a.b;
@com.tns.JavaScriptImplementation(javaScriptFile = "./ExtendedBase.js")
public class ExtendedBase extends a.b.Base implements com.tns.NativeScriptHashCodeProvider {
/* default constructor */
public ExtendedBase () {
this("Arbitrary String");
}
public ExtendedBase (java.lang.String param_0){
super(param_0);
/*
Additional logic to handle more arguments -> a result of the init function
*/
com.tns.Runtime.initInstance(this);
}
}
Generating custom constructors based on the javascript code will require additional analysis, and may not be worth looking into at the moment.
- 主要言語
- C++
- スター
- 563
- フォーク
- 144
- 平均マージ
- 10時間 46分
- マージ済み PR(30日)
- 14
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NativeScript/android のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
NativeScript/android#2039 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
NativeScript/android#2024 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
NativeScript/android#2020 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
NativeScript/android#2019 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
NativeScript/android#1986 ·
NativeScript/android の issue をすべて見る
似ている issue
-
[BUG] オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
eunomia-bpf/llvmbpf#51 · コメント 1 件 ·
-
status:needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
PX4/PX4-Autopilot#28776 ·
-
Website Doc Typo オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
難易度 1/5 1〜3時間 初心者へのやさしさ 92/100
autowarefoundation/autoware_universe#13413 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100