jextract/jni: Overloads with protocol parameters generate duplicate adapter classes

Abierto
#946 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
53/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java, swift

Línea de trabajo

Start by reading the JNI extraction path that emits protocol-parameter adapters when enableJavaCallbacks is enabled; the issue does not name a file or test, so locate it from that option and the generated adapter name. Reproduce with the two Client initializers in the issue and inspect generated Swift for duplicate class declarations. Done when overloaded initializers, instance methods, and free functions that need the same adapter generate compilable Swift.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Problem

With enableJavaCallbacks enabled, JNI extraction emits a protocol-parameter adapter for each function declaration. Overloads with the same function name, parameter name, and enclosing type can require the same adapter, so the generated Swift contains duplicate class declarations and fails to compile.

Example

Both initializers below generate an adapter with the same name for store:

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

public struct Client {
  public init(store: some Store) {}
  public init(store: some Store, extra: Int64) {}
}

The duplicate adapter declarations cause the generated Swift to fail compilation. The same problem can occur with overloaded instance methods and free functions.

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

Lenguaje dominante
Swift
Estrellas
1.3k
Forks
127
Merge medio
2 d 14 h
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de swiftlang/swift-java

Todos los issues de swiftlang/swift-java

Issues similares

Más issues de Swift

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.