jextract/jni: Enum case record names can collide with enclosing types

Aperta
#944 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
57/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java, swift

Direzione di ricerca

Read the jextract/jni enum extraction code and its generated Java output for the Message example. Trace how Swift case names determine record names, payload accessors, and case dispatch; check the generated output with a case that collides with an enclosing type. Done means the generated record avoids the collision and its accessor and dispatch names stay consistent.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

JNI enum extraction capitalizes each Swift case name to generate a nested Java record. That record can have the same name as its enum, another enclosing type, or the generated Case interface. Java rejects these declarations because a nested type cannot share an enclosing type's name.

Example

public enum Message {
  case message(Int64)
}

The generated Java code contains a record named Message inside Message.Case. This conflicts with the enclosing Message type and causes Java compilation to fail.

The generated record name should avoid collisions with enclosing types. Its payload accessor and case dispatch should use the same name consistently.

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

Lingua principale
Swift
Stelle
1.3k
Fork
127
Merge medio
2g 14h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di swiftlang/swift-java

Tutte le issue di swiftlang/swift-java

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.