Skip to content

ALT-11006 Fix SDK selection blocked in 2026.1#33

Open
adkozlov wants to merge 3 commits intomainfrom
adkozlov/ALT-11006
Open

ALT-11006 Fix SDK selection blocked in 2026.1#33
adkozlov wants to merge 3 commits intomainfrom
adkozlov/ALT-11006

Conversation

@adkozlov
Copy link
Copy Markdown
Collaborator

@adkozlov adkozlov commented Apr 6, 2026

Summary

  • Wrap preselectJdk background task in try/finally to guarantee the JDK combo box is always re-enabled
  • On failure, set FAILED loading state so validation shows a meaningful error instead of staying in Pending forever
  • Simplify availability check by throwing on missing JDKs (handled uniformly in catch)

Test plan

  • Open a Hyperskill project via "Solve in IDE" in IntelliJ 2026.1 with JDKs installed — SDK should be auto-selected
  • Open a Hyperskill project with no JDKs installed — combo box should be enabled, error message shown
  • Verify macOS and Windows

@adkozlov adkozlov self-assigned this Apr 6, 2026
@adkozlov adkozlov requested a review from meanmail April 6, 2026 23:34
@adkozlov adkozlov force-pushed the adkozlov/ALT-11006 branch from 2e78d8b to 651bd9d Compare April 6, 2026 23:46
Copy link
Copy Markdown
Contributor

@meanmail meanmail left a comment

Choose a reason for hiding this comment

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

Overall the fix looks good — try/finally is the right approach to guarantee combo box re-enablement. A few minor comments below.

// Check if we found any JDK at all (either suitable or any)
if (sdksModel.sdks.all { it.sdkType != JavaSdk.getInstance() }
&& ProjectJdkTable.getInstance().getSdksOfType(JavaSdk.getInstance()).isEmpty()) {
throw RuntimeException(EduJVMBundle.message("error.no.jdk.available"))
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.

nit: Throwing RuntimeException for a normal business scenario (no JDKs installed) to unify error handling in the outer catch works, but reads a bit odd. An alternative would be to set FAILED state directly and skip to finally via return@runInBackground. Not a blocker — current approach is functional.

error.no.jdk.need.at.least=JDK is not selected. In the settings section, choose or download some JDK with a version at least {0}
error.no.jdk.available=No JDK found on your system. Please <a href="{0}">configure JDK</a> in IDE settings
error.jdk.loading.failed=Failed to load JDK list. Please check your IDE settings or <a href="{0}">configure JDK manually</a>
error.no.jdk.available=No JDK found on your system. Please configure JDK in IDE settings
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.

question: The <a href="{0}">...</a> links were removed from these messages. Were they previously rendered as clickable hyperlinks anywhere in the UI (e.g. in a notification or validation panel)? If so, users lose a quick shortcut to JDK settings. If they were never actually rendered as hyperlinks, the cleanup makes sense.

@meanmail
Copy link
Copy Markdown
Contributor

meanmail commented Apr 7, 2026

nit: isJdkLoading (line 58-60 in JdkLanguageSettings.kt) is marked "Keep for backward compatibility" but it's private and unused anywhere in the codebase. Consider removing this dead code as a follow-up.

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