jextract/jni: Inherited protocol requirements can be renamed inconsistently when a child adds an overload
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Ambito
- backend-api-design, devtools
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Swift
- Stelle
- 1.3k
- Fork
- 127
- Merge medio
- 2g 14h
- PR unite (30g)
- 5
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di swiftlang/swift-java
-
wrap-java: Optional convenience methods can fail to compile when a parameter shadows the method nameAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
swiftlang/swift-java#945 ·
I maintainer di solito rispondono entro 1 giorno
-
android
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
swiftlang/swift-java#663 · 4 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 56/100
swiftlang/swift-java#949 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
swiftlang/swift-java#948 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
swiftlang/swift-java#947 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di swiftlang/swift-java
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AttilaTheFun/visor#244 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: cua-driver skill fails Agent Skills frontmatter validationForse già presa @Mearman l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
follow-up needs-triage S3: minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
manaflow-ai/cmux#36856 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
appandflow/stim#5255 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
karansinghgit/speaktype#211 ·