Skip to content

Translating Foundation types requires explicit Foundation import #536

Open

Description

@timofeys1

The Foundation types are currently translated in full only when there is an explicit Foundation import in the source files where they are used. IIUC, this way Swift Java guards against user-defined Data types since it can't typecheck the Data use site. This behavior is visible in Samples/SwiftJavaExtractFFMSampleApp/Sources/MySwiftLibrary/MySwiftLibrary.swift if you switch import Foundation to import AppKit, which I think exports the Foundation through the modulemap, and run the sample. The jextract task succeeds, but the Java compilation fails because the Data.java wrapper is missing the expected APIs.

Similarly, the @_exported import Foundation doesn't seem to work.

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

    feature:jextractIssues related to jextract-swift

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions