Skip to content

Commit

Permalink
Avoid using boxed boolean in applyValueToSingleValuedField
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiehong authored and remkop committed Jan 7, 2023
1 parent 070d2e9 commit 907e1c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/picocli/CommandLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -14158,7 +14158,7 @@ private int applyValueToSingleValuedField(ArgSpec argSpec,
// boolean option with arity = 0..1 or 0..*: value MAY be a param
boolean optionalWithBooleanValue = arity.max > 0 && ("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value));
if (!optionalWithBooleanValue && lookBehind != LookBehind.ATTACHED_WITH_SEPARATOR) { // if attached, try converting the value to boolean (and fail if invalid value)
Boolean defaultValue = booleanValue(argSpec, argSpec.calcDefaultValue(true)); // #712 flip the default value
boolean defaultValue = booleanValue(argSpec, argSpec.calcDefaultValue(true)); // #712 flip the default value
if (argSpec.isOption() && !empty(((OptionSpec) argSpec).fallbackValue())) {
defaultValue = !booleanValue(argSpec, ((OptionSpec) argSpec).fallbackValue()); // #754 Allow boolean options to get value from fallback instead of defaultProvider
}
Expand Down

0 comments on commit 907e1c0

Please sign in to comment.