Skip to content

Classes with a type parameter fail to compile #533

@abdulowork

Description

@abdulowork

I searched through the issues, but couldn't find an explicit issue about the missing support for generics. In particular if you have a public class such as:

public class Foo<T> {
    public init() {}
}

in Samples/SwiftJavaExtractFFMSampleApp/Sources/MySwiftLibrary/Foo.swift, then the Swift wrappers compilation currently fails with:

error: generic parameter 'T' could not be inferred
 26 | @_cdecl("swiftjava_getType_MySwiftLibrary_Foo")
 27 | public func swiftjava_getType_MySwiftLibrary_Foo() -> UnsafeMutableRawPointer /* Any.Type */ {
 28 |   return unsafeBitCast(Foo.self, to: UnsafeMutableRawPointer.self)
    |                        |- error: generic parameter 'T' could not be inferred
    |                        `- note: explicitly specify the generic arguments to fix this issue

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