DATACMNS-840 - ReturnedClass now aborts parameter name detection for types with multiple constructors.
In case a DTO type exposes multiple no-argument constructors we now leniently abort the parameter name detection and let downstream users decide what to do in this particular case. The problematic case can't be outright rejected here already as there's valid scenarios for that, e.g. in JPA the type could be used for multiple query methods, using explict constructor expressions listing arguments explicitly and thereby select one of the multiple constructors.
This commit is contained in:
@@ -283,6 +283,11 @@ public abstract class ReturnedType {
|
||||
|
||||
PreferredConstructorDiscoverer<?, ?> discoverer = new PreferredConstructorDiscoverer(type);
|
||||
PreferredConstructor<?, ?> constructor = discoverer.getConstructor();
|
||||
|
||||
if (constructor == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<String> properties = new ArrayList<String>();
|
||||
|
||||
for (PreferredConstructor.Parameter<Object, ?> parameter : constructor.getParameters()) {
|
||||
|
||||
Reference in New Issue
Block a user