@@ -62,7 +62,7 @@ final class GenericsWrapJavaTests: XCTestCase {
6262 open class ExampleSimpleClass: JavaObject {
6363 """ ,
6464 """
65- @JavaMethod(genericResult : " KeyType! " )
65+ @JavaMethod(typeErasedResult : " KeyType! " )
6666 open func getGeneric<KeyType: AnyJavaObject>(_ arg0: Item<KeyType>?) -> KeyType!
6767 """ ,
6868 ]
@@ -100,7 +100,7 @@ final class GenericsWrapJavaTests: XCTestCase {
100100 classpath: [ classpathURL] ,
101101 expectedChunks: [
102102 """
103- @JavaMethod(genericResult : " KeyType! " )
103+ @JavaMethod(typeErasedResult : " KeyType! " )
104104 open func getGeneric<KeyType: AnyJavaObject>() -> KeyType!
105105 """ ,
106106 ]
@@ -194,11 +194,11 @@ final class GenericsWrapJavaTests: XCTestCase {
194194 classpath: [ classpathURL] ,
195195 expectedChunks: [
196196 """
197- @JavaMethod(genericResult : " T! " )
197+ @JavaMethod(typeErasedResult : " T! " )
198198 open func getClassGeneric() -> T!
199199 """ ,
200200 """
201- @JavaMethod(genericResult : " M! " )
201+ @JavaMethod(typeErasedResult : " M! " )
202202 open func getMethodGeneric<M: AnyJavaObject>() -> M!
203203 """ ,
204204 """
@@ -292,7 +292,7 @@ final class GenericsWrapJavaTests: XCTestCase {
292292 """
293293 @JavaClass( " com.example.Kappa " )
294294 open class Kappa<T: AnyJavaObject>: JavaObject {
295- @JavaMethod(genericResult : " T! " )
295+ @JavaMethod(typeErasedResult : " T! " )
296296 open func get() -> T!
297297 }
298298 """
@@ -331,11 +331,43 @@ final class GenericsWrapJavaTests: XCTestCase {
331331 }
332332 """ ,
333333 """
334- @JavaStaticMethod(genericResult : " T! " )
334+ @JavaStaticMethod(typeErasedResult : " T! " )
335335 public func nonNull<T: AnyJavaObject>(_ arg0: T?) -> T! where ObjectType == Optional<T>
336336 """
337337 ]
338338 )
339339 }
340+
341+ // TODO: this should be improved some more, we need to generated a `: Map` on the Swift side
342+ func test_wrapJava_genericMethodTypeErasure_genericExtendsMap( ) async throws {
343+ let classpathURL = try await compileJava (
344+ """
345+ package com.example;
346+
347+ final class Map<T, U> {}
348+
349+ final class Something {
350+ public <M extends Map<String, String>> M putIn(M map) { return null; }
351+ }
352+ """ )
353+
354+ try assertWrapJavaOutput (
355+ javaClassNames: [
356+ " com.example.Map " ,
357+ " com.example.Something " ,
358+ ] ,
359+ classpath: [ classpathURL] ,
360+ expectedChunks: [
361+ """
362+ @JavaClass( " com.example.Something " )
363+ open class Something: JavaObject {
364+ """ ,
365+ """
366+ @JavaMethod(typeErasedResult: " M! " )
367+ open func putIn<M: AnyJavaObject>(_ arg0: M?) -> M!
368+ """ ,
369+ ]
370+ )
371+ }
340372
341373}
0 commit comments