Use correct type with set
- When target is set and only one option argument is given, we should not convert to list as user expects string to xxx Converter to work. - This is how it used to work and previous changes caused regression. - Bug is actually in an old parser and new parser works fine. - Backport #667 - Fixes #670
This commit is contained in:
@@ -478,9 +478,16 @@ public interface CommandParser {
|
||||
// if it looks like type is a collection just get as list
|
||||
// as conversion will happen later. we just need to know
|
||||
// if user has Set, List, Collection, etc without worrying
|
||||
// about generics.
|
||||
// about generics. handle explicit size 1 so that we're
|
||||
// able to handle string to xxx converter as that what
|
||||
// user expects.
|
||||
else if (type != null && type.asCollection() != ResolvableType.NONE) {
|
||||
value = arguments.stream().collect(Collectors.toList());
|
||||
if (arguments.size() == 1) {
|
||||
value = arguments.get(0);
|
||||
}
|
||||
else {
|
||||
value = arguments.stream().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!arguments.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user