Skip to content

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

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!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions