diff --git a/Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaTranslation.swift b/Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaTranslation.swift index 1f97f13e..e294f2ef 100644 --- a/Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaTranslation.swift +++ b/Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaTranslation.swift @@ -1458,7 +1458,14 @@ extension JNISwift2JavaGenerator { genericParameters: [SwiftGenericParameterDeclaration], genericRequirements: [SwiftGenericRequirement], ) throws -> JavaType { - try translateGenericTypeParameter( + switch swiftType { + case let .tuple(elements): + if elements.count != 1 { throw JavaTranslationError.unsupportedSwiftType(swiftType) } + default: + break + } + + return try translateGenericTypeParameter( swiftType, genericParameters: genericParameters, genericRequirements: genericRequirements, diff --git a/Tests/JExtractSwiftTests/JNI/JNIDictionaryTest.swift b/Tests/JExtractSwiftTests/JNI/JNIDictionaryTest.swift index ebb8ed16..3a64aa67 100644 --- a/Tests/JExtractSwiftTests/JNI/JNIDictionaryTest.swift +++ b/Tests/JExtractSwiftTests/JNI/JNIDictionaryTest.swift @@ -322,4 +322,34 @@ struct JNIDictionaryTest { ] ) } + + @Test("Import: () -> [UInt32: tuple] is unsupported") + func tupleDictionaryValue_swift() throws { + try assertOutput( + input: """ + public enum ResponseType { + case ok + } + + public class BindingStore { + public typealias RawResponse = (requestId: UInt32, stringResponse: String, responseType: ResponseType, finished: Bool) + public static var completeResponses: [UInt32: RawResponse] = [:] + } + """, + .jni, + .swift, + expectedChunks: [], + notExpectedChunks: [ + """ + dictionaryGetJNIValue + """, + """ + getCompleteResponses + """, + """ + setCompleteResponses + """, + ] + ) + } }