Skip to content

boolean with arity=0 and defaultValue=false behaves unexpectedly #2380

@leonard84

Description

@leonard84
    @CommandLine.Option(names = "--flag", arity = "0")
    boolean flag;

results in false when --flag is not used ✅

    @CommandLine.Option(names = "--flag", arity = "0", defaultValue = "false")
    boolean flag

results in true when --flag is not used ❌

   @CommandLine.Option(names = "--flag", defaultValue = "false")
    boolean flag

results in false when --flag is not used ✅

    @CommandLine.Option(names = "--flag", defaultValue = "true")
    boolean flag

results in true when --flag is not used ✅

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions