-
Couldn't load subscription status.
- Fork 38.8k
Open
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)theme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin supporttype: enhancementA general enhancementA general enhancement
Milestone
Description
Background
Context Parameters were introduced in Kotlin 2.1.20 and are currently in Beta status in Kotlin 2.2.0 under the flag -Xcontext-parameters (announcement)
Issue
Spring's KotlinReflectionParameterNameDiscoverer cannot detect Context Parameters in Kotlin methods. The kotlinFunction property returns incomplete results - context parameters are completely absent from the reflection data.
Use Case
I'm migrating from Context Receivers to Context Parameters for implementing security via HandlerMethodArgumentResolver. My implementation:
- Uses a custom
UserContextclass as a context parameter - Injects it into controller handler methods
- Propagates it through service method calls
Technical Details
- Current implementation relies on: KotlinReflectionParameterNameDiscoverer.java#L46
- Related Kotlin issues:
- KT-78752: Context Parameters missing in reflection - I'm asking to fix
kotlinFunction, hopefully in 2.1.22/2.2.10 - KT-74529: Context parameters support in reflection - Card about support of context parameters targeting 2.2.20
- KT-78752: Context Parameters missing in reflection - I'm asking to fix
Expected
- Track support for Context Parameters in Spring Framework (if KT-78752 will be resolved)
- Add support for the new parameter kind coming in Kotlin 2.2.20 when reflection API is available
vdshb
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)theme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin supporttype: enhancementA general enhancementA general enhancement