Skip to content

使用 Java 8 运行时禁止更新 #4032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 2, 2025
Merged

使用 Java 8 运行时禁止更新 #4032

merged 2 commits into from
Jul 2, 2025

Conversation

Glavo
Copy link
Member

@Glavo Glavo commented Jun 23, 2025

No description provided.

@Glavo Glavo linked an issue Jun 23, 2025 that may be closed by this pull request
@Glavo Glavo requested a review from Copilot June 23, 2025 05:42
Copy link

@Copilot 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 prevents automatic updates when running HMCL on Java 8 by introducing a version check, centralizing download link logic, and adding new localized resource strings.

  • Added a new update requirement dialog for Java versions below 11 in both the upgrade flow and startup tips.
  • Refactored architecture-specific Java download link generation into Metadata.getSuggestedJavaDownloadLink().
  • Introduced new fatal.deprecated_java_version.update keys in English, Simplified Chinese, and Traditional Chinese resource files.

Reviewed Changes

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

Show a summary per file
File Description
HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties Added fatal.deprecated_java_version.update message in Simplified Chinese.
HMCL/src/main/resources/assets/lang/I18N_zh.properties Added fatal.deprecated_java_version.update message in Traditional Chinese.
HMCL/src/main/resources/assets/lang/I18N.properties Added English fatal.deprecated_java_version.update multi-line property.
HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateHandler.java Inserted pre-check to block updates on Java < 11 with an error dialog.
HMCL/src/main/java/org/jackhuang/hmcl/ui/Controllers.java Simplified Java version tip logic to use the new metadata method and constants.
HMCL/src/main/java/org/jackhuang/hmcl/Metadata.java Defined MINIMUM_REQUIRED_JAVA_VERSION and MINIMUM_SUPPORTED_JAVA_VERSION, and added getSuggestedJavaDownloadLink().
Comments suppressed due to low confidence (5)

HMCL/src/main/java/org/jackhuang/hmcl/Metadata.java:42

  • [nitpick] MINIMUM_SUPPORTED_JAVA_VERSION and MINIMUM_REQUIRED_JAVA_VERSION names are very similar. Consider renaming them (e.g., MINIMUM_RUN_JAVA_VERSION vs. MINIMUM_UPGRADE_JAVA_VERSION) to clarify their distinct purposes.
    public static final int MINIMUM_SUPPORTED_JAVA_VERSION = 11;

HMCL/src/main/java/org/jackhuang/hmcl/Metadata.java:103

  • Add JavaDoc for getSuggestedJavaDownloadLink() to explain its behavior, return value (including null), and when it should be used.
    public static @Nullable String getSuggestedJavaDownloadLink() {

HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateHandler.java:106

  • Add unit or integration tests for this new Java version check in updateFrom(...) to verify that the correct error dialog is shown when running on unsupported Java versions.
        if (JavaRuntime.CURRENT_VERSION < Metadata.MINIMUM_SUPPORTED_JAVA_VERSION) {

HMCL/src/main/java/org/jackhuang/hmcl/Metadata.java:103

  • Add tests for getSuggestedJavaDownloadLink() across different operating systems and architectures to ensure correct URLs or null are returned.
    public static @Nullable String getSuggestedJavaDownloadLink() {

HMCL/src/main/resources/assets/lang/I18N.properties:410

  • The multi-line property fatal.deprecated_java_version.update is missing line continuation backslashes on its last line, which can break parsing. Ensure each continuation line ends with a \\ and that newline escapes are correct.
  and will automatically select the appropriate Java for you based on the game version.

@HMCL-dev HMCL-dev deleted a comment from Copilot AI Jul 2, 2025
@Glavo Glavo merged commit d492884 into HMCL-dev:main Jul 2, 2025
3 checks passed
@Glavo Glavo deleted the update branch July 2, 2025 15:44
@burningtnt
Copy link
Member

burningtnt commented Jul 3, 2025

如果发出的最后一个支持 Java 8 的正式版中有重大 Bug,我们将不可能再让用户升级到修复后的版本!
应当能否在 update_json 中添加新的字段,指示当前版本不支持 Java 8

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.

[Feature] 放弃对于 Java 8 的兼容性
3 participants