fix: updating to latest devkitman#2484
Conversation
📝 WalkthroughWalkthroughDevkitman dependency is updated from 0.4.6 to 0.4.8. JDK list text output now displays linked JDK references, and the uninstall success message prints only after confirming the JDK is no longer installed. ChangesJDK Commands and Build Dependencies
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
This fixes the problem with uninstalls of Jdks sometimes leaving dangling links which confuse older JBangs
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/java/dev/jbang/cli/Jdk.java`:
- Around line 303-306: The uninstall flow currently returns EXIT_OK even when
the JDK remains installed; update the code in class Jdk after calling
uninstall() to check jdk.isInstalled() and if it is still true throw a
dev.jbang.cli.ExitException with a non-zero exit code and a clear error message
(e.g., "Failed to uninstall JDK: <jdk.id()>"). Ensure you use the ExitException
type for controlled exits rather than returning EXIT_OK so callers/picocli see
the non-zero failure status.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 804267df-e8a0-4f12-a0cf-a5a015da4dd8
📒 Files selected for processing (2)
build.gradlesrc/main/java/dev/jbang/cli/Jdk.java
| if (!jdk.isInstalled()) { | ||
| Util.infoMsg("Uninstalled JDK:\n " + jdk.id()); | ||
| } | ||
| return EXIT_OK; |
There was a problem hiding this comment.
Return a non-zero exit when uninstall did not actually remove the JDK.
If jdk.isInstalled() remains true after uninstall(), the command currently exits with EXIT_OK and no message. That masks a failed uninstall.
Suggested fix
jdk.uninstall();
- if (!jdk.isInstalled()) {
- Util.infoMsg("Uninstalled JDK:\n " + jdk.id());
- }
+ if (!jdk.isInstalled()) {
+ Util.infoMsg("Uninstalled JDK:\n " + jdk.id());
+ } else {
+ throw new ExitException(EXIT_INVALID_INPUT, "Failed to uninstall JDK: " + jdk.id());
+ }
return EXIT_OK;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (!jdk.isInstalled()) { | |
| Util.infoMsg("Uninstalled JDK:\n " + jdk.id()); | |
| } | |
| return EXIT_OK; | |
| if (!jdk.isInstalled()) { | |
| Util.infoMsg("Uninstalled JDK:\n " + jdk.id()); | |
| } else { | |
| throw new ExitException(EXIT_INVALID_INPUT, "Failed to uninstall JDK: " + jdk.id()); | |
| } | |
| return EXIT_OK; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/java/dev/jbang/cli/Jdk.java` around lines 303 - 306, The uninstall
flow currently returns EXIT_OK even when the JDK remains installed; update the
code in class Jdk after calling uninstall() to check jdk.isInstalled() and if it
is still true throw a dev.jbang.cli.ExitException with a non-zero exit code and
a clear error message (e.g., "Failed to uninstall JDK: <jdk.id()>"). Ensure you
use the ExitException type for controlled exits rather than returning EXIT_OK so
callers/picocli see the non-zero failure status.
|
failing tests seems related? |
This fixes the problem with uninstalls of Jdks sometimes leaving dangling links which confuse older JBangs
Summary by CodeRabbit
Chores
New Features
Bug Fixes