Skip to content

Commit 86e06ef

Browse files
committed
add a test using wrap-java and a java stdlib type
1 parent a595159 commit 86e06ef

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

Tests/SwiftJavaToolLibTests/WrapJavaTests/BasicWrapJavaTests.swift

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,46 @@ final class BasicWrapJavaTests: XCTestCase {
198198
]
199199
)
200200
}
201+
202+
func test_wrapJava_inheritFromBiFunction() async throws {
203+
let classpathURL = try await compileJava(
204+
"""
205+
package com.example;
206+
207+
import java.util.function.BiFunction;
208+
209+
interface CallMe<ValueType> extends BiFunction<ValueType, ValueType, ValueType> {
210+
@Override
211+
ValueType apply(
212+
ValueType newest,
213+
ValueType oldest
214+
);
215+
}
216+
""")
217+
218+
try assertWrapJavaOutput(
219+
javaClassNames: [
220+
"java.util.function.BiFunction",
221+
"com.example.CallMe",
222+
],
223+
classpath: [classpathURL],
224+
expectedChunks: [
225+
"""
226+
@JavaInterface("com.example.CallMe", extends: BiFunction<ValueType, ValueType, ValueType>.self)
227+
public struct CallMe<ValueType: AnyJavaObject> {
228+
/**
229+
* Java method `apply`.
230+
*
231+
* ### Java method signature
232+
* ```java
233+
* public abstract ValueType com.example.CallMe.apply(ValueType,ValueType)
234+
* ```
235+
*/
236+
@JavaMethod(typeErasedResult: "ValueType!")
237+
public func apply(_ arg0: ValueType?, _ arg1: ValueType?) -> ValueType!
238+
}
239+
""",
240+
]
241+
)
242+
}
201243
}

0 commit comments

Comments
 (0)