Skip to content

Enhance Kotlin Support for Suppliers, Functions, and Consumers #1277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
apoupard opened this issue May 8, 2025 · 1 comment
Open

Enhance Kotlin Support for Suppliers, Functions, and Consumers #1277

apoupard opened this issue May 8, 2025 · 1 comment

Comments

@apoupard
Copy link

apoupard commented May 8, 2025

Description:

This issue tracks the need to improve and solidify Kotlin support within Spring Cloud Function, aiming for seamless integration with various Kotlin features like suspend functions, Flow types, and different functional arities/signatures.

Recent compatibility testing, including tests such as KotlinConsumerArityBeanTest, KotlinFunctionArityBeanTest, and KotlinSupplierArityBeanTest (commit related to these tests: "Test: Add arity tests for Kotlin functions, consumers, and suppliers"), revealed several areas where Kotlin function signatures are not handled as expected. This has led to runtime exceptions and test failures. The recent test execution for these arity bean tests showed 43 failures and 3 errors out of 118 total tests, highlighting significant areas for improvement.

The goal is to address these failures and ensure robust support for the wide range of functional styles available in Kotlin.

Tested Signature Compatibility Summary:

The following tables summarize the pass/fail status for the tested Kotlin signatures based on the recent test execution. "FAIL" indicates that at least one test case for that signature (or its variants, like Java-style/Kotlin-style implementations where applicable) resulted in a failure or error.

Suppliers
(Based on tests like KotlinSupplierArityBeanTest)

# Signature Bean Name Suffix Status
1 () -> R Plain PASS
2 () -> Flow<R> Flow PASS
3 suspend () -> R SuspendPlain FAIL
4 suspend () -> Flow<R> SuspendFlow PASS
5 () -> Mono<R> Mono PASS
6 () -> Flux<R> Flux PASS
7 () -> Message<R> Message PASS
8 () -> Mono<Message<R>> MonoMessage PASS
9 suspend () -> Message<R> SuspendMessage FAIL
10 () -> Flux<Message<R>> FluxMessage PASS
11 () -> Flow<Message<R>> FlowMessage FAIL
12 suspend () -> Flow<Message<R>> SuspendFlowMessage PASS

Functions
(Based on tests like KotlinFunctionArityBeanTest)

# Signature Bean Name Suffix Status
1 (T) -> R PlainToPlain PASS
2 (T) -> Flow<R> PlainToFlow PASS
3 (Flow<T>) -> R FlowToPlain FAIL
4 (Flow<T>) -> Flow<R> FlowToFlow FAIL
5 suspend (T) -> R SuspendPlainToPlain FAIL
6 suspend (T) -> Flow<R> SuspendPlainToFlow FAIL
7 suspend (Flow<T>) -> R SuspendFlowToPlain FAIL
8 suspend (Flow<T>) -> Flow<R> SuspendFlowToFlow FAIL
9 (T) -> Mono<R> PlainToMono PASS
10 (T) -> Flux<R> PlainToFlux PASS
11 (Mono<T>) -> Mono<R> MonoToMono PASS
12 (Flux<T>) -> Flux<R> FluxToFlux PASS
13 (Flux<T>) -> Mono<R> FluxToMono PASS
14 (Message<T>) -> Message<R> MessageToMessage PASS
15 suspend (Message<T>) -> Message<R> SuspendMessageToMessage FAIL
16 (Mono<Message<T>>) -> Mono<Message<R>> MonoMessageToMonoMessage PASS
17 (Flux<Message<T>>) -> Flux<Message<R>> FluxMessageToFluxMessage PASS
18 (Flow<Message<T>>) -> Flow<Message<R>> FlowMessageToFlowMessage FAIL
19 suspend (Flow<Message<T>>) -> Flow<Message<R>> SuspendFlowMessageToFlowMessage FAIL

Consumers
(Based on tests like KotlinConsumerArityBeanTest)

# Signature Bean Name Suffix Status
1 (T) -> Unit Plain PASS
2 (Flow<T>) -> Unit Flow FAIL
3 suspend (T) -> Unit SuspendPlain FAIL
4 suspend (Flow<T>) -> Unit SuspendFlow PASS
5 (T) -> Mono<Void> MonoInput PASS
6 (Mono<T>) -> Mono<Void> Mono PASS
7 (Flux<T>) -> Mono<Void> Flux PASS
8 (Message<T>) -> Unit Message PASS
9 (Mono<Message<T>>) -> Mono<Void> MonoMessage PASS
10 suspend (Message<T>) -> Unit SuspendMessage FAIL
11 (Flux<Message<T>>) -> Unit FluxMessage PASS
12 (Flow<Message<T>>) -> Unit FlowMessage FAIL
13 suspend (Flow<Message<T>>) -> Unit SuspendFlowMessage PASS

Addressing these failures is crucial for providing a first-class Kotlin experience in Spring Cloud Function.

@apoupard
Copy link
Author

apoupard commented May 8, 2025

Just wanted to update that a Merge Request has been created to address the Kotlin arity issues detailed in this issue: #1278

This MR includes the necessary changes to fix all the described arity issues for Kotlin functions, consumers, and suppliers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant