Fixes: Enhance Kotlin Support for Suppliers, Functions, and Consumers #1277 #1278
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This merge request aims to enhance and solidify Kotlin support within Spring Cloud Function. It addresses several identified issues related to the handling of various Kotlin features, including
suspend
functions,Flow
types, and different functional arities/signatures for Suppliers, Functions, and Consumers.Recent compatibility testing highlighted a number of scenarios where Kotlin function declarations were not being processed as expected, leading to runtime exceptions and test failures. This MR introduces fixes and improvements to the
spring-cloud-function-context
to better interpret and manage diverse Kotlin functional styles.Key Changes:
spring-cloud-function-context
has been refactored to more comprehensively handle various declaration combinations for Kotlin functions, consumers, and suppliers.spring-cloud-function-kotlin
module. These tests cover a wide range of Kotlin function, consumer, and supplier declarations to ensure their correct behavior and to help identify areas for further improvement.Summary of Addressed Issues from Testing:
The changes in this MR specifically target issues observed during testing, such as:
UnsupportedOperationException
andNullPointerException
related tosuspend
function handling.ClassCastException
when dealing withkotlinx.coroutines.flow.Flow
andorg.springframework.messaging.Message
types.DecodingException
for certain reactive types likeFlow
.By addressing these points, this MR significantly improves the robustness and usability of Spring Cloud Function for Kotlin developers, aiming to provide a more seamless and first-class experience.