Skip to content

Calling PersistentPropertyAccessor.setProperty(…) on Kotlin data class objects with multiple copy methods can lead to ArrayIndexOutOfBoundsException #2324

Closed
@tano

Description

@tano

There is flaky problem which leads to ArrayIndexOutOfBoundsException when dealing with Kotlin data classes with copy method having default values as entities in ClassGeneratingPropertyAccessorFactory.PropertyAccessorClassGenerator.generateCustomAccessorClass.

Please check this demo which reproduces the issue (just try to run ProblemDemoTests for several times and you'll receive ArrayIndexOutOfBoundsException): https://github.com/tano/aioob-demo/blob/master/src/test/kotlin/org/springframework/data/mapping/model/ProblemDemoTests.kt

Removing attempts: Int = this.attempts default parameter solves the issues.

Version details:
Java: openjdk version "11.0.9.1" 2020-11-04 LTS
Kotlin: 1.4.30
spring-data-commons: 2.4.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions