This is an automated email from the ASF dual-hosted git repository. rpopma pushed a commit to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git
commit accf1215010701983dfdc2c67a055ae86b817a9f Author: Remko Popma <[email protected]> AuthorDate: Wed Apr 29 15:05:52 2020 +0900 GROOVY-9519: zero default for non-Boolean type options should not be converted to false (cherry picked from commit 719cffb57458fa144081c67f5b295d16bdbe86ad) --- .../src/main/groovy/groovy/cli/picocli/OptionAccessor.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subprojects/groovy-cli-picocli/src/main/groovy/groovy/cli/picocli/OptionAccessor.groovy b/subprojects/groovy-cli-picocli/src/main/groovy/groovy/cli/picocli/OptionAccessor.groovy index 2ce0bb8..4fac7c1 100644 --- a/subprojects/groovy-cli-picocli/src/main/groovy/groovy/cli/picocli/OptionAccessor.groovy +++ b/subprojects/groovy-cli-picocli/src/main/groovy/groovy/cli/picocli/OptionAccessor.groovy @@ -126,6 +126,8 @@ class OptionAccessor { if (parseResult.commandSpec().findOption(name)) { // requested option was not matched: return its default def option = parseResult.commandSpec().findOption(name) def result = option.value + Class userSpecifiedType = savedTypeOptions[name]?.type // GROOVY-9519: zero default for non-Boolean type options should not be converted to false + if (userSpecifiedType && Boolean != userSpecifiedType) { return result } return result ? result : false } if (name.size() > 1 && name.endsWith('s')) { // user wants multi-value result
