Skip to content

Fix bean introspection for Kotlin extension methods#12547

Merged
graemerocher merged 1 commit into
5.0.xfrom
fix-10669-kotlin-extension-bean-methods
Jun 6, 2026
Merged

Fix bean introspection for Kotlin extension methods#12547
graemerocher merged 1 commit into
5.0.xfrom
fix-10669-kotlin-extension-bean-methods

Conversation

@yawkat

@yawkat yawkat commented Mar 20, 2026

Copy link
Copy Markdown
Member

Summary

  • model Kotlin extension receivers as method parameters in KotlinMethodElement
  • use the same parameter view when generating bean method metadata for introspections
  • add a regression test for invoking an @Executable Kotlin extension method through BeanIntrospection

Problem

BeanIntrospection bean methods for Kotlin extension functions were generated without the extension receiver in the method signature. That made invocations like addOne.invoke(bean, 1) resolve to a zero-argument JVM method and fail with NoSuchMethodError.

Verification

  • ran :micronaut-inject-kotlin:test --tests 'io.micronaut.kotlin.processing.visitor.BeanIntrospectionSpec.test generate bean method for kotlin extension function'
  • verified the targeted regression passes under Java 25 (JAVA_HOME=/usr/lib/jvm/java-25-openjdk)

Resolves #10669

@yawkat yawkat requested a review from dstepanov March 20, 2026 13:33
@sonarqubecloud

Copy link
Copy Markdown

@graemerocher graemerocher merged commit 4c4c005 into 5.0.x Jun 6, 2026
14 checks passed
@graemerocher graemerocher deleted the fix-10669-kotlin-extension-bean-methods branch June 6, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BeanIntrospection dispath method generated is wrong for Kotlin extension functions.

2 participants