Skip to content

jextract issues with nested types that share the same name #822

Closed

Description

@llsc12

my environment:
swift-java: main @ c235a0f
swift-java-jni-core: main @ b440a0be98381550cf189c903782e817619ffa05
using swift 6.3.3 and im using the jni mode.

my module contains several nested types which share the same name. example 1 example2

reproduced with this snippet.

public struct Outer: Sendable, Codable {
  public enum Kind: Sendable, Codable {
    case alpha
    case beta
  }
}

extension Outer {
  public struct Inner: Sendable, Codable {
    public struct Innermost: Sendable, Codable {
      public enum Kind: Sendable, Codable {
        case x
        case y
      }

      public var kind: Kind // Outer.Inner.Innermost.Kind

      public init(kind: Kind) {
        self.kind = kind
      }
    }

    public var innermost: Innermost

    public init(innermost: Innermost) {
      self.innermost = innermost
    }
  }
}

the jextract plugin doesn't produce fully qualified types. in my own package, it had issues with DiscordChannel.Message.MessageReference.Kind which became DiscordChannel.Kind. in the above snippet its like Outer.Inner.Kind becoming Outer.Kind. i think its specifically for extensions.

the repo i'm working on is available here:
https://github.com/llsc12/Paicord/tree/android-2

thank you!

Activity

  1. self-assigned this
    on Jul 9, 2026
  2. ktoso commented on Jul 9, 2026

    @ktoso
    Collaborator

    Thanks for the report, I'll have a look what's up

  3. llsc12 commented on Jul 9, 2026

    @llsc12
    ContributorAuthor

    i'm also lightly looking into it and i think there's quite a few layers of issues before my swift package will be buildable with swift-java. hmm

  4. ktoso commented on Jul 9, 2026

    @ktoso
    Collaborator

    Fix incoming here #823

  5. llsc12 commented on Jul 9, 2026

    @llsc12
    ContributorAuthor

    thank you very much!

  6. ktoso commented on Jul 9, 2026

    @ktoso
    Collaborator

    I also checked the extension case you had, please check current main!

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

Metadata

Metadata

Assignees

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