Skip to content

[#2506] Preserve original required state - #2525

Open
emerardd wants to merge 1 commit into
remkop:mainfrom
emerardd:agent/fix-originally-required
Open

[#2506] Preserve original required state#2525
emerardd wants to merge 1 commit into
remkop:mainfrom
emerardd:agent/fix-originally-required

Conversation

@emerardd

Copy link
Copy Markdown

Summary

  • initialize originallyRequired from annotated option and positional parameter definitions
  • keep programmatic builder calls in sync with the original required state
  • let argument groups change only the effective required flag
  • render the required marker for options that were actually declared required, with regression coverage for annotated, programmatic, positional, and argument-group cases

Closes #2506.

Validation

Using JDK 21:

  • .\gradlew.bat :test --tests 'picocli.HelpTest.testDefaultOptionRenderer_usesOriginalRequiredStateForArgGroupOptions' --tests 'picocli.ModelArgSpecTest.testOriginallyRequiredReflectsAnnotatedRequiredState' --console=plain --configure-on-demand --rerun-tasks (both new tests passed)
  • .\gradlew.bat :test --tests 'picocli.HelpTest' --tests 'picocli.ModelArgSpecTest' --console=plain --configure-on-demand --rerun-tasks (301 tests, 0 failures, 1 skipped)
  • .\gradlew.bat :compileJava --console=plain --configure-on-demand --rerun-tasks
  • git diff --check

The root-module test run completed 2,283 tests: 2,282 passed and 32 were skipped; the only failure was the existing Windows/Jansi environment probe HelpAnsiTest.testAnsiEnabled. Maven/Gradle Plugin Portal TLS handshakes were unavailable in this environment, so the successful local runs used the cached dependencies through a temporary offline init script; CI should provide the authoritative clean-environment result.

@emerardd
emerardd marked this pull request as ready for review July 24, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ArgSpec.originallyRequired() does not actually preserve original required setting

1 participant