@@ -49,54 +49,49 @@ class WrapJavaTests: XCTestCase {
4949 }
5050
5151 func testWrapJavaGenericMethod_singleGeneric( ) async throws {
52- do {
53- let classpathURL = try await compileJava (
54- """
55- package com.example;
52+ let classpathURL = try await compileJava (
53+ """
54+ package com.example;
5655
57- class Item<T> {
58- final T value;
59- Item(T item) {
60- this.value = item;
61- }
56+ class Item<T> {
57+ final T value;
58+ Item(T item) {
59+ this.value = item;
6260 }
63- class Pair<First, Second> { }
61+ }
62+ class Pair<First, Second> { }
6463
65- class ExampleSimpleClass {
66- <KeyType> KeyType getGeneric(Item<KeyType> key) { return null; }
67- }
68- """ )
64+ class ExampleSimpleClass {
65+ <KeyType> KeyType getGeneric(Item<KeyType> key) { return null; }
66+ }
67+ """ )
6968
70- try assertWrapJavaOutput (
71- javaClassNames: [
72- " com.example.Item " ,
73- " com.example.Pair " ,
74- " com.example.ExampleSimpleClass "
75- ] ,
76- classpath: [ classpathURL] ,
77- expectedChunks: [
78- """
79- import CSwiftJavaJNI
80- import SwiftJava
81- """ ,
82- """
83- @JavaClass( " com.example.ExampleSimpleClass " )
84- open class ExampleSimpleClass: JavaObject {
85- """ ,
86- """
87- @JavaClass( " com.example.ExampleSimpleClass " )
88- open class ExampleSimpleClass: JavaObject {
89- """ ,
90- """
91- @JavaMethod
92- open func getGeneric<KeyType: AnyJavaObject>(_ arg0: Item<KeyType>?) -> KeyType {
93- """ ,
94- ]
95- )
96- } catch let error as Throwable {
97- error. printStackTrace ( )
98- XCTFail ( " error: \( error) " )
99- }
69+ try assertWrapJavaOutput (
70+ javaClassNames: [
71+ " com.example.Item " ,
72+ " com.example.Pair " ,
73+ " com.example.ExampleSimpleClass "
74+ ] ,
75+ classpath: [ classpathURL] ,
76+ expectedChunks: [
77+ """
78+ import CSwiftJavaJNI
79+ import SwiftJava
80+ """ ,
81+ """
82+ @JavaClass( " com.example.ExampleSimpleClass " )
83+ open class ExampleSimpleClass: JavaObject {
84+ """ ,
85+ """
86+ @JavaClass( " com.example.ExampleSimpleClass " )
87+ open class ExampleSimpleClass: JavaObject {
88+ """ ,
89+ """
90+ @JavaMethod
91+ open func getGeneric<KeyType: AnyJavaObject>(_ arg0: Item<KeyType>?) -> KeyType {
92+ """ ,
93+ ]
94+ )
10095 }
10196
10297 // This is just a warning in Java, but a hard error in Swift, so we must 'prune' generic params
0 commit comments