检测到系统 zlib 实现为 zlib-ng 时跳过 Forge/NeoForge 安装时的哈希检测#6068
Conversation
… verification for dynamically generated JARs
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a ZlibUtils utility to detect if the system's zlib implementation produces standard compressed output. This is used to prevent installation failures in ForgeNewInstallTask when alternative libraries like zlib-ng cause SHA-1 mismatches in dynamically generated JARs; in such cases, the system now falls back to a structural integrity check. Review feedback suggests avoiding wildcard imports in Launcher.java, using case-insensitive comparisons for file extensions, and declaring the IS_ZLIB_COMPATIBLE flag as final.
| import org.jackhuang.hmcl.util.FileSaver; | ||
| import org.jackhuang.hmcl.util.Lang; | ||
| import org.jackhuang.hmcl.util.StringUtils; | ||
| import org.jackhuang.hmcl.util.*; |
There was a problem hiding this comment.
建议避免使用通配符导入(wildcard import)。根据 Google Java 编程风格指南以及本项目现有的代码风格,应当使用具体的类导入,以提高代码的可读性并避免潜在的命名冲突。
| import org.jackhuang.hmcl.util.*; | |
| import org.jackhuang.hmcl.util.CrashReporter; | |
| import org.jackhuang.hmcl.util.FileSaver; | |
| import org.jackhuang.hmcl.util.Lang; | |
| import org.jackhuang.hmcl.util.StringUtils; | |
| import org.jackhuang.hmcl.util.ZlibUtils; |
| } | ||
|
|
||
| if (!Objects.equals(code, entry.getValue())) { | ||
| if (!ZlibUtils.IS_ZLIB_COMPATIBLE && FileUtils.getExtension(artifact).equals("jar")) { |
There was a problem hiding this comment.
|
Glavo你真是活跃。 |
No description provided.