Skip to content

Fix bean introspection for Kotlin extension methods#12547

Open
yawkat wants to merge 1 commit into
5.0.xfrom
fix-10669-kotlin-extension-bean-methods
Open

Fix bean introspection for Kotlin extension methods#12547
yawkat wants to merge 1 commit into
5.0.xfrom
fix-10669-kotlin-extension-bean-methods

Conversation

@yawkat
Copy link
Copy Markdown
Member

@yawkat yawkat commented Mar 20, 2026

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

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.

1 participant