Closed
Description
Daniel Jones opened SPR-16931 and commented
I have a configuration properties kotlin class with a kotlin enum property. If the class is annotated with @Validated
an exception occurs in hibernate-validator's ParameterMetadata
class due to an IndexOutOfBoundsException
.
This seems to happen due to the underlying ParameterNameDiscoverer
, KotlinReflectionParameterNameDiscoverer
.
I think this is due to the validator class expecting a 2-parameter constructor (name, ordinal) but KotlinReflectionParameterNameDiscoverer
returns an empty array.
Example configuration properties class:
@ConfigurationProperties("my.prefix")
@Validated
data class MyProperties(
var enumProp: MyEnum = MyEnum.ONE
) {
enum class MyEnum {
ONE, TWO
}
}
Affects: 5.0.6
Referenced from: commits 2c5a1af, 73db208
Backported to: 5.0.11