Allow command options to have nullable types and default values (#1444)

This commit is contained in:
Jen Basch authored and GitHub committed 2026-02-26 08:34:46 -08:00
1 parent 3ef065b6b6
commit 4cf2a1b42c
4 files changed
+2 -32

No files matched your search

@@ -513,12 +513,6 @@ public final class CommandSpecParser {
var typeNode = resolved.getFirst();
isNullable = resolved.getSecond();
defaultValue = CommandSpecParser.this.getDefaultValue(prop, requireExplicitDefault);
if (isNullable && defaultValue != null) {
throw exceptionBuilder()
.evalError("commandOptionTypeNullableWithDefaultValue", prop.getName())
.withSourceSection(prop.getHeaderSection())
.build();
}
resolve(prop, typeNode);
return this;
@@ -1098,11 +1098,6 @@ Found both `@Flag` and `@Argument` annotations for options property `{0}`.\n\
\n\
Only one option type may be specified.
commandOptionTypeNullableWithDefaultValue=\
Unexpected option property `{0}` with nullable type and default value.\n\
\n\
Options with default values must not be nullable.
commandOptionUnsupportedType=\
Command option property `{0}` has unsupported {1}type `{2}`.