Skip to content

fix: make app setup --java/--no-java usable as flags - #2701

Merged
maxandersen merged 1 commit into
jbangdev:mainfrom
maxandersen:fix/app-setup-java-flag
Nov 5, 2026
Merged

maxandersen merged 1 commit into
jbangdev:mainfrom
maxandersen:fix/app-setup-java-flag

Conversation

@maxandersen

@maxandersen maxandersen commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

jbang app setup --java and --no-java failed with Option java was specified, but no value was given; only --java=true worked. The negatable option lacked hasValue = false, unlike every other negatable option.

Input Before After
app setup guesses guesses (unchanged)
app setup --java error adds jbang's Java
app setup --no-java error doesn't add it

Adds TestApp.testAppSetupJavaFlag (fails without the fix).

Summary by CodeRabbit

  • Bug Fixes
    • The app setup Java option now behaves consistently as a flag: it remains unset by default, can be enabled with --java, and disabled with --no-java.

The negatable --java option of 'jbang app setup' lacked hasValue = false,
so '--java' and '--no-java' failed with "Option java was specified, but no
value was given" (only '--java=true' worked). Declare it as an on/off flag
like the other negatable options; without it jbang still guesses.
@maxandersen

Copy link
Copy Markdown
Collaborator Author

i think this was missed in piccoli move ? wdyt @quintesse ?

@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The app setup --java option is declared as a flag. A test checks the default value and parsing of --java and --no-java.

Changes: App setup Java flag

Layer / File(s) Summary
Declare and test the Java flag
src/main/java/dev/jbang/cli/App.java, src/test/java/dev/jbang/cli/TestApp.java
The java option declares hasValue = false. The test checks that the value is unset by default, true with --java, and false with --no-java.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Suggested reviewers: stalep

Merge Risk: Minimal · up to 68c95

The change makes both Java flag forms usable without altering plain app setup behavior.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the fixed behavior: making app setup --java and --no-java work as flags. The raw summary shows AppSetup.java now sets hasValue = false on the --java option, and a new test co…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fixed behavior: making app setup --java and --no-java work as flags. The raw summary shows AppSetup.java now sets hasValue = false on the --java option, and a new test covers the flag forms. The title matches the main change and is specific, so it passes.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 2d67c06 and 68c950d.

Files selected for processing: 2
  • src/main/java/dev/jbang/cli/App.java
  • src/test/java/dev/jbang/cli/TestApp.java

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@quintesse

Copy link
Copy Markdown
Contributor

i think this was missed in piccoli move ? wdyt @quintesse ?

I guess so, to be honest I didn't even know/remember we had that option! I had to look up what it does

@maxandersen
maxandersen merged commit cce144b into jbangdev:main Nov 5, 2026
30 checks passed
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.

2 participants