Skip to content

Bump Gson to 2.13.2#4490

Merged
Glavo merged 4 commits intoHMCL-dev:mainfrom
Glavo:gson
Sep 16, 2025
Merged

Bump Gson to 2.13.2#4490
Glavo merged 4 commits intoHMCL-dev:mainfrom
Glavo:gson

Conversation

@Glavo
Copy link
Copy Markdown
Member

@Glavo Glavo commented Sep 16, 2025

No description provided.

Copy link
Copy Markdown
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 Gson library from version 2.13.0 to 2.13.2 and refactors the TypeUtils class to use modern Java pattern matching features and remove dependency on internal Gson classes.

Key changes:

  • Updated Gson dependency version in the build configuration
  • Replaced traditional instanceof checks with pattern matching in TypeUtils
  • Removed dependency on internal Gson utility methods by implementing them locally

Reviewed Changes

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

File Description
gradle/libs.versions.toml Updates Gson version from 2.13.0 to 2.13.2
HMCLCore/src/main/java/org/jackhuang/hmcl/util/TypeUtils.java Modernizes code with pattern matching, removes internal Gson dependencies, and adds proper annotations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +55 to +56
if (!condition) {
throw new IllegalArgumentException();
Copy link

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

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

The checkArgument method throws an IllegalArgumentException without a descriptive error message. This makes debugging difficult when the condition fails. Consider adding a message parameter or using a default message that describes the validation failure.

Suggested change
if (!condition) {
throw new IllegalArgumentException();
checkArgument(condition, "Argument condition failed");
}
private static void checkArgument(boolean condition, String message) {
if (!condition) {
throw new IllegalArgumentException(message);

Copilot uses AI. Check for mistakes.
* support what the target Java version supports - at most one bound, see also
* https://bugs.openjdk.java.net/browse/JDK-8250660. If a lower bound is set, the upper bound must
* be Object.class.
* <a href="https://bugs.openjdk.java.net/browse/JDK-8250660">JDK-8250660</a>.
Copy link

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

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

The URL in the documentation link appears to be incorrect. The correct URL for OpenJDK bug reports is 'https://bugs.openjdk.org/browse/JDK-8250660' (using .org instead of .java.net).

Suggested change
* <a href="https://bugs.openjdk.java.net/browse/JDK-8250660">JDK-8250660</a>.
* <a href="https://bugs.openjdk.org/browse/JDK-8250660">JDK-8250660</a>.

Copilot uses AI. Check for mistakes.
@Glavo Glavo merged commit e4bc8f4 into HMCL-dev:main Sep 16, 2025
2 checks passed
@Glavo Glavo deleted the gson branch September 16, 2025 06:56
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