Skip to content

[Feature] 让Java下载页面可以同时下载多个Java#5394

Merged
Glavo merged 14 commits intoHMCL-dev:mainfrom
NoClassFoundError:5371mutidownloadJava
Feb 14, 2026
Merged

[Feature] 让Java下载页面可以同时下载多个Java#5394
Glavo merged 14 commits intoHMCL-dev:mainfrom
NoClassFoundError:5371mutidownloadJava

Conversation

@NoClassFoundError
Copy link
Contributor

No description provided.

@NoClassFoundError
Copy link
Contributor Author

#5371

@NoClassFoundError NoClassFoundError marked this pull request as ready for review February 2, 2026 14:32
@NoClassFoundError NoClassFoundError marked this pull request as draft February 2, 2026 14:33
@NoClassFoundError NoClassFoundError marked this pull request as ready for review February 2, 2026 14:47
@NoClassFoundError
Copy link
Contributor Author

cc @3gf8jv4dv

@3gf8jv4dv
Copy link
Contributor

我在 #2988 (review) 建议过搞一个复选框,但 Glavo 最后没做。不知道现在 Glavo 怎么想。

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Mojang Java download dialog to support selecting and downloading multiple Java major versions in one operation.

Changes:

  • Replace single-choice radio buttons with multi-select checkboxes and update dialog validation accordingly.
  • Update accept handler to gather multiple selected versions and download them sequentially (including optional override flow).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +207 to +213
else chain = chain.thenComposeAsync(Schedulers.javafx(), ignore -> task);
}

for (GameJavaVersion v : notInstalled) {
Task<?> task = downloadTask(v);
if (chain == null) chain = task;
else chain = chain.thenComposeAsync(Schedulers.javafx(), ignore -> task);
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The download chain is built with thenComposeAsync(...), which stops executing subsequent tasks if any earlier download fails (because thenComposeAsync relies on dependents succeeding). With multi-select, a single failed Java download will prevent the remaining selected versions from downloading. Consider chaining with withComposeAsync(...) (doesn’t break the chain on dependent failure) or wrapping each per-version task so failures are handled and the chain continues, while still reporting errors to the user.

Suggested change
else chain = chain.thenComposeAsync(Schedulers.javafx(), ignore -> task);
}
for (GameJavaVersion v : notInstalled) {
Task<?> task = downloadTask(v);
if (chain == null) chain = task;
else chain = chain.thenComposeAsync(Schedulers.javafx(), ignore -> task);
else chain = chain.withComposeAsync(Schedulers.javafx(), ignore -> task);
}
for (GameJavaVersion v : notInstalled) {
Task<?> task = downloadTask(v);
if (chain == null) chain = task;
else chain = chain.withComposeAsync(Schedulers.javafx(), ignore -> task);

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (exceptions.size() == 1) {
exceptionToDisplay = exceptions.get(0);
} else {
exceptionToDisplay = new IOException("Failed to download Java");
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

The error message "Failed to download Java" is hardcoded in English, which is inconsistent with the internationalization (i18n) pattern used throughout the codebase. This message should use the i18n() function to support multiple languages, similar to how other error messages in this file use i18n("install.failed") on line 199. Consider using an i18n key like i18n("download.java.failed") or a similar localized message.

Suggested change
exceptionToDisplay = new IOException("Failed to download Java");
exceptionToDisplay = new IOException(i18n("download.java.failed"));

Copilot uses AI. Check for mistakes.
@Glavo Glavo merged commit 80ba1ec into HMCL-dev:main Feb 14, 2026
8 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.

4 participants