Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This commit introduces a comprehensive suite of tests to cover all possible declarations of Kotlin functions, consumers, and suppliers within the `spring-cloud-function-kotlin` module. The primary goal of these tests is to explore the various declaration combinations and identify potential areas for improvement and enhanced support in the framework. Signed-off-by: Adrien Poupard <adrien@komune.io>
This commit refactors the `spring-cloud-function-context` to comprehensively handle all combinations of possible declarations for Kotlin functions, consumers, and suppliers. This improves the framework's ability to correctly interpret and manage different Kotlin functional styles. Signed-off-by: Adrien Poupard <adrien@komune.io>
This commit adds new unit tests to verify the core logic for Kotlin arity handling and wrapper mechanisms. These tests cover various scenarios including catalogue registration and native type casting for consumers, functions, and suppliers. Signed-off-by: Adrien Poupard <adrien@komune.io>
Signed-off-by: Adrien Poupard <adrien@komune.io>
… Kotlin type handling and consistency. Signed-off-by: Adrien Poupard <adrien@komune.io>
…ction validation Signed-off-by: Adrien Poupard <adrien@komune.io>
- Port spring-cloudGH-1300 post-processing: KotlinFunctionWrapper exposes getKotlinLambdaTarget(), implemented by every Kotlin wrapper; SimpleFunctionRegistry and the Kotlin catalog test use it instead of the removed KotlinLambdaToFunctionAutoConfiguration.KotlinFunctionWrapper. - Non-suspend Flow wrappers declare Flux<T> instead of Flux<Flow<T>> (unwrap with KotlinUtils.getFlowTypeArguments, as the suspend wrappers do); with the stricter JSON conversion on main the old type made Flow inputs fail with 500. - CoroutinesUtils: bound generic outputs to Any, required by Reactor's nullness annotations (Flux<T : Any>). - Boot 4: AutoConfigureWebTestClient moved to org.springframework.boot.webtestclient.autoconfigure. - License headers to the 20xx-present format and import order, for checkstyle.
apoupard
force-pushed
the
feat/kotlin-arity-relanding
branch
from
October 1, 2026 19:42
5779a92 to
b30982b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Re-lands the Kotlin function arity rework from spring-cloud#1278 on top of current
main.Why
spring-cloud#1278 was "squashed and merged" upstream as
62d73bf9bon 2025-06-20, but that commit sits on a line of history that was later dropped frommain: no upstream branch (main, 5.0.x, 4.3.x) and no release (v4.3.1–v4.3.3, v5.0.0–v5.0.4) contains it. Upstream still detects Kotlin lambdas withKotlinLambdaToFunctionAutoConfiguration's exact-arity check, which is why F2 has to carry the arity patch on its vendored copy (fixers/5.0.4, #7). With this rework in, that patch can go.Commits
029fc7444arity tests,a8b0f891farity handling,5c917a584unit tests,76537c10adocs,6dfc8ee6aTypeUtils → KotlinUtils,50b8929fbFunctionUtils → KotlinUtils. Same 60 files and identical content as the upstream squash62d73bf9b. Only conflict (in the arity-handling commit):KotlinLambdaToFunctionAutoConfigurationis deleted by the rework but was edited onmainsince (Function post processing doesn't work with Kotlin classes spring-cloud/spring-cloud-function#1300 post-processing, license header) → resolved as delete, Function post processing doesn't work with Kotlin classes spring-cloud/spring-cloud-function#1300 ported in the last commit.b30982b87: adaptations to currentmainKotlinFunctionWrapper.getKotlinLambdaTarget(), implemented by all 15 Kotlin wrappers;SimpleFunctionRegistryandContextFunctionCatalogAutoConfigurationKotlinTestsuse it instead of the removedKotlinLambdaToFunctionAutoConfiguration.KotlinFunctionWrapper.FlowToPlain,FlowToFlow,ConsumerFlow,SupplierFlow) declaredFlux<Flow<T>>; they now declareFlux<T>viaKotlinUtils.getFlowTypeArguments, like the suspend wrappers. In June a failed element conversion silently fell back to the raw value; withmain's stricter JSON conversion (fix(context): propagate JSON deserialization error instead of silent ClassCastException spring-cloud/spring-cloud-function#1429) it surfaced as 500 / wrong body inKotlinFunctionArityBeanTest.testFunctionFlowToPlain/testFunctionFlowToFlow.CoroutinesUtilsgeneric outputs bounded toAny(Flux<T : Any>).AutoConfigureWebTestClientmoved toorg.springframework.boot.webtestclient.autoconfigure.20xx-presentlicense headers on the new files, import order.Verification
./mvnw -pl spring-cloud-function-context,spring-cloud-function-kotlin -am test, all green, no flakes: