DATACMNS-1082 - Skip synthetic constructors.
Constructor discovery no longer considers synthetic constructors for preferred constructor. Original pull request: #225
This commit is contained in:
committed by
Jens Schauder
parent
11c1ad8025
commit
cabfa287cb
@@ -34,6 +34,7 @@ import org.springframework.data.util.TypeInformation;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Roman Rodov
|
||||
*/
|
||||
public class PreferredConstructorDiscoverer<T, P extends PersistentProperty<P>> {
|
||||
|
||||
@@ -75,6 +76,11 @@ public class PreferredConstructorDiscoverer<T, P extends PersistentProperty<P>>
|
||||
|
||||
PreferredConstructor<T, P> preferredConstructor = buildPreferredConstructor(candidate, type, entity);
|
||||
|
||||
// Synthetic constructors should not be considered
|
||||
if (preferredConstructor.getConstructor().isSynthetic()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Explicitly defined constructor trumps all
|
||||
if (preferredConstructor.isExplicitlyAnnotated()) {
|
||||
this.constructor = Optional.of(preferredConstructor);
|
||||
|
||||
Reference in New Issue
Block a user