-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Labels
feature:jextractIssues related to jextract-swiftIssues related to jextract-swiftfeature:wrap-javamode:jni
Description
We are now able to handle generics more properly in wrap-java and now we import Optional as:
@JavaClass("java.util.Optional")
open class JavaOptional<T: AnyJavaObject>: JavaObject {
@JavaMethod
open func get() -> T!
which then crashes
SwiftJava/JavaOptional.swift:2: Fatal error: 'try!' expression unexpectedly raised an error: java.lang.NoSuchMethodError: Ljava/util/Optional;.get()Ljava/lang/String;
so the String bit is coming unexpectedly because Swift sees the reified generic type as "String" and not "some T" therefore the downcall is forming an incorrect signature.
The problem is somewhere in the dynamicJavaMethodCall infra which can't handle the generic properly when forming the downcall signature
Metadata
Metadata
Assignees
Labels
feature:jextractIssues related to jextract-swiftIssues related to jextract-swiftfeature:wrap-javamode:jni