Skip to content

Translating Foundation types requires explicit Foundation import #536

@abdulowork

Description

@abdulowork

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.

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