Skip to content

KotlinReflectionParameterNameDiscoverer does not handle instance-extension methods properly [SPR-16119] #20667

@spring-projects-issues

Description

@spring-projects-issues

Take Weiland opened SPR-16119 and commented

KotlinReflectionParameterNameDiscoverer filters out any parameters that are not of type KParameter.Kind.VALUE.
This works fine, except if you have an extension method inside a class, like this:

class Example {
    // this method will look like doSomething(String) in the bytecode and to Java
    fun String.doSomething()
}

The extension receiver (KParameter.Kind.EXTENSION_RECEIVER) parameter must not be ignored here, since as far as Java code is concerned, this is a regular parameter.

I noticed this problem in combination with Hibernate Validator, which will throw an ArrayIndexOutOfBoundsException when analyzing such a method.

I am in the process of creating a pull request to fix this issue and will update this ticket when it is submitted.


Affects: 5.0.1

Referenced from: commits 0e49e32

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions