Move suspend/reactive route validation to processor#12539
Open
yawkat wants to merge 4 commits into
Open
Conversation
Fixes #11131 Co-Authored-By: multicode <multicode@yawk.at>
Co-Authored-By: multicode <multicode@yawk.at>
|
graemerocher
approved these changes
Apr 17, 2026
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.



Summary
RouteValidationVisitorrecognize Kotlin/KSP route methods whereHttpMethodMappingis exposed as a stereotype rather than a direct annotationDefaultRouteInfoRouteValidationVisitorthrough a narrow route-only visitor providerWhy
Issue #11131 reproduces a bad failure mode when a suspended controller method returns a reactive type after prior suspension. Rather than rejecting that shape during route construction at runtime, this change moves the unsupported-signature check into the existing
http-validationprocessor path so developers get earlier feedback.Implementation details
SuspendedReactiveReturnTypeRulenow checks the declared suspended method return type and explicitly rejectskotlinx.coroutines.flow.Flowin addition to other async/reactive typesRouteValidationVisitornow falls back to stereotype-aware lookup forHttpMethodMapping, which is necessary for Kotlin/KSP route methods annotated with@Getinject-kotlin-testnow supports opt-in extra KSPSymbolProcessorProviders without changing default behavior for existing testsTypeElementSymbolProcessor, avoiding unrelated service-loaded visitors from polluting the test pathVerification
Targeted end-to-end verification passes with:
Results:
suspend fun hello(): Stringcompilessuspend fun hello(): Flow<String>fails during KSP/visitor processing with:Unsupported suspended controller return type [kotlinx.coroutines.flow.Flow]. Suspend functions must not return reactive or async types.Notes
Fixes #11131