jextract/jni: Inherited protocol requirements can be renamed inconsistently when a child adds an overload
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 58/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
Start by reading the jextract/jni code that generates Java interfaces, box methods, and JNI thunks for protocol requirements; the issue does not name specific files or tests. Trace how the parent and child overloads in the NamingParent/NamingChild example get their Java names, then check whether both operations dispatch to the correct Swift requirement and the child box implements the parent interface. Done means Java compilation succeeds and both overloads call the intended Swift method.
索引モデルが issue の本文から書いたものです。
説明
Problem
When a child protocol adds an overload of an inherited requirement, the generated Java box can rename the inherited method based on the child's overload set. The parent Java interface still declares the method under its original name, so the child box does not implement the parent interface and Java compilation fails.
Example
public protocol NamingParent {
var id: Int64 { get }
func value(number: Int64) -> Int64
}
public protocol NamingChild: NamingParent {
var tag: Int64 { get }
func value(text: Int64) -> Int64
}
struct NamingValue: NamingChild {
var id: Int64 { 1 }
var tag: Int64 { 2 }
func value(number: Int64) -> Int64 { number + 10 }
func value(text: Int64) -> Int64 { text + 20 }
}
public func makeNamingChild() -> any NamingChild {
NamingValue()
}
Swift argument labels distinguish the two requirements, but Java cannot represent both as value(long) on the child interface.
The parent interface exposes value(number:) as value(long). However, the generated child box can emit valueNumber(long) for that inherited requirement after considering the child's overload. This does not implement the parent's value(long) method.
The inherited requirement should keep the name declared by the parent interface. For example, the generated bindings could use value(long) for value(number:) and valueText(long) for value(text:). The Java interfaces, box methods, and JNI thunks should use consistent names so that both operations dispatch to the correct Swift requirement.
Reference workaround implementation: https://github.com/qoncept/swift-java/pull/3
- 主要言語
- Swift
- スター
- 1.3k
- フォーク
- 127
- 平均マージ
- 2日 14時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
swiftlang/swift-java のほかの issue
-
wrap-java: Optional convenience methods can fail to compile when a parameter shadows the method nameオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
swiftlang/swift-java#945 ·
メンテナーはふだん 1 日以内に返信
-
android
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
swiftlang/swift-java#663 · コメント 4 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
swiftlang/swift-java#949 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
swiftlang/swift-java#948 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 54/100
swiftlang/swift-java#947 ·
メンテナーはふだん 1 日以内に返信
swiftlang/swift-java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AttilaTheFun/visor#244 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: cua-driver skill fails Agent Skills frontmatter validation対応中かも @Mearman が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
follow-up needs-triage S3: minor
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
manaflow-ai/cmux#36856 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
appandflow/stim#5255 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
karansinghgit/speaktype#211 ·