jextract/jni: Protocol property setters reference an incorrectly named adapter

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
56/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java, swift
領域
backend, tooling

調査の方向性

Start by tracing the generated JNI binding for a public protocol-typed property with Java callbacks enabled, comparing the wrapper declaration name with the setter argument conversion reference. Check the related protocol-parameter adapter issue #946 for nearby context. Done when property setters, label-disambiguated overloads, and Java keyword names generate matching adapter references and the resulting Swift compiles.

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

説明

Problem

With Java callbacks enabled, JNI bindings for a public protocol-typed property can generate a Swift setter that references a wrapper class under a different name from its declaration. The generated Swift code then fails to compile.

Example

public protocol Callback {
  func value() -> Int64
}

public final class Service {
  public var callback: any Callback

  public init(callback: some Callback) {
    self.callback = callback
  }

  public func read() -> Int64 {
    callback.value()
  }
}

The generated wrapper declaration uses the Swift property name, while the setter's argument conversion uses the Java setter name:

// Generated wrapper declaration
final class _Service_callback_newValue_Wrapper: SwiftJavaCallbackWrapper {
  // ...
}

// Generated setter argument conversion references
// _Service_setCallback_newValue_Wrapper instead.

The same kind of mismatch can occur when Java method names differ from Swift names for label-disambiguated overloads or Java keywords.

Related: #946 also concerns protocol-parameter adapters, but reports duplicate declarations for overloads.

Reference workaround implementation: https://github.com/qoncept/swift-java/pull/16

主要言語
Swift
スター
1.3k
フォーク
127
平均マージ
2日 14時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

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

swiftlang/swift-java のほかの issue

swiftlang/swift-java の issue をすべて見る

似ている issue

Swift の issue をもっと見る

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

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