Skip to content

fix: updating to latest devkitman#2484

Open
quintesse wants to merge 1 commit into
jbangdev:mainfrom
quintesse:fix_uninstall
Open

fix: updating to latest devkitman#2484
quintesse wants to merge 1 commit into
jbangdev:mainfrom
quintesse:fix_uninstall

Conversation

@quintesse
Copy link
Copy Markdown
Contributor

@quintesse quintesse commented May 29, 2026

This fixes the problem with uninstalls of Jdks sometimes leaving dangling links which confuse older JBangs

Summary by CodeRabbit

  • Chores

    • Updated the build tooling dependency to a newer stable version.
  • New Features

    • The JDK list command now displays linked JDK information when a link is configured, providing clearer context about your available JDKs.
  • Bug Fixes

    • The JDK uninstall command now only displays the success message when the uninstallation is confirmed to be complete.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

📝 Walkthrough

Walkthrough

Devkitman 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.

Changes

JDK Commands and Build Dependencies

Layer / File(s) Summary
Devkitman dependency version bump
build.gradle
devkitmanVersion constant updated from 0.4.6 to 0.4.8, affecting all usages of the dev.jbang:devkitman dependency.
JDK command output improvements
src/main/java/dev/jbang/cli/Jdk.java
Jdk list text output now conditionally appends "link to " for JDK entries with a non-null linkedId. Jdk uninstall now prints the success message only when the uninstalled JDK reports as not installed.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A version bumps from old to new,
Dependency chains find fresher brew,
While JDK's list now links with care,
And uninstall confirms what's there!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title partially relates to the changeset; it mentions updating devkitman, but omits the key fix for uninstall dangling links which is the main objective. Consider revising the title to better reflect the main purpose: 'fix: handle dangling links in JDK uninstall' or 'fix: update devkitman to resolve JDK uninstall issues'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

This fixes the problem with uninstalls of Jdks sometimes leaving
dangling links which confuse older JBangs
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0c1b40a and 75298ed.

📒 Files selected for processing (2)
  • build.gradle
  • src/main/java/dev/jbang/cli/Jdk.java

Comment on lines +303 to 306
if (!jdk.isInstalled()) {
Util.infoMsg("Uninstalled JDK:\n " + jdk.id());
}
return EXIT_OK;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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;
As per coding guidelines, "Throw `dev.jbang.cli.ExitException` for controlled exits; let picocli report parameter issues".
📝 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.

Suggested change
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.

@maxandersen
Copy link
Copy Markdown
Collaborator

failing tests seems related?

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