From 907e1c0427d45a12db23c17180b8e0aff36de451 Mon Sep 17 00:00:00 2001 From: Jiehong Ma Date: Thu, 5 Jan 2023 21:39:03 +0100 Subject: [PATCH] Avoid using boxed boolean in applyValueToSingleValuedField --- src/main/java/picocli/CommandLine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/picocli/CommandLine.java b/src/main/java/picocli/CommandLine.java index 2e8a24877..feed90650 100644 --- a/src/main/java/picocli/CommandLine.java +++ b/src/main/java/picocli/CommandLine.java @@ -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 }