NativeScript / NativeScript/android

Android d.ts generator fails to create typings for nested data class

オープン
#1,754 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C++
スター
563
フォーク
144
平均マージ
10時間 46分
マージ済み PR(30日)
14

説明

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 8.5
  • Cross-platform modules: 8.5.0
  • Android Runtime: 8.5.0
  • Android d.ts Generator : 3.0.0
  • iOS Runtime (if applicable): 8.5.1
  • Plugin(s):

Describe the bug
It seems Android d.ts generator has trouble generating types for data classes declared inside functions.
Generator log output:

Android d.ts Generator Version : 3.0.0
ignoring definitions in missing dependency: android.text.TextWatcher
ignoring definitions in missing dependency: android.view.View$OnFocusChangeListener
Generation of definitions took 712ms.
Typings have been generated in the following directory: ./typings

To Reproduce
This is the kotlin function with class declaration: https://github.com/RedMadRobot/input-mask-android/blob/eee78324eb4cdb4faab3248ef646d5750507b598/inputmask/src/main/kotlin/com/redmadrobot/inputmask/MaskedTextChangedListener.kt#L294

These are the typings generated, you will notice a brace is missing on module pickMask:

export module MaskedTextChangedListener {
	export module pickMask {
	export module ValueListener {
		export class MaskAffinity {
			public static class: java.lang.Class<com.redmadrobot.inputmask.MaskedTextChangedListener.pickMask.MaskAffinity>;
			public component1(): com.redmadrobot.inputmask.helper.Mask;
			public getAffinity(): number;
			public component2(): number;
			public copy(param0: com.redmadrobot.inputmask.helper.Mask, param1: number): com.redmadrobot.inputmask.MaskedTextChangedListener.pickMask.MaskAffinity;
			public hashCode(): number;
			public equals(param0: any): boolean;
			public getMask(): com.redmadrobot.inputmask.helper.Mask;
			public toString(): string;
			public constructor(param0: com.redmadrobot.inputmask.helper.Mask, param1: number);
		}
	}
}

Expected behavior
Typings should be generated without problems.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

再現手順にリンクされている Kotlin 関数宣言から始め、その出力を issue に示されている生成済みの typings と比較します。Android d.ts Generator によるネストされた data classes の処理を追跡し、欠落しているモジュールの中括弧なしで typings を再生成して完了することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, kotlin, typescript
領域
mobile, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。