Skip to content

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

Open

Description

@teamhimeh

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: qoncept#7

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions