Skip to content

KotlinReflectionParameterNameDiscoverer doesn't support Kotlin Context Parameters #35134

Description

@IRus

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 UserContext class as a context parameter
  • Injects it into controller handler methods
  • Propagates it through service method calls

Technical Details

Expected

  1. Track support for Context Parameters in Spring Framework (if KT-78752 will be resolved)
  2. Add support for the new parameter kind coming in Kotlin 2.2.20 when reflection API is available

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: feedback-providedFeedback has been providedtheme: kotlinAn issue related to Kotlin supporttype: enhancementA general enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions