Synthetic constructors should not be considered persistence constructors [DATACMNS-1082] #1526
As the title says Synthetic Constructors Should not be considered by org.springframework.data.mapping.model.PreferredConstructorDiscoverer as it is also common for them not to have correct parameter names to map to fields.
Exmaple, in Kotlin combined with Spring Data Mongo
The following class (just a dumbed down example):
Will cause Kotlin to generate 2 constructors (because of the use of "default" parameter:
PreferredConstructorDiscoverer in random order (sometimes it will, sometimes it won't, due to order of the constructors in bytecode) will pick the synthetic constructor which will cause a MappingException with message: No property null found on entity Address to bind constructor parameter to! Notice the null value. That is because the synthetic constructor does not have parameter meta data.
I have a PR ready, which is super simple I guess
Affects: 2.0 M3 (Kay), 1.13.3 (Ingalls SR3)
Referenced from: pull request #225
The text was updated successfully, but these errors were encountered: