Conversation
There was a problem hiding this comment.
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.
| if (!condition) { | ||
| throw new IllegalArgumentException(); |
There was a problem hiding this comment.
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.
| if (!condition) { | |
| throw new IllegalArgumentException(); | |
| checkArgument(condition, "Argument condition failed"); | |
| } | |
| private static void checkArgument(boolean condition, String message) { | |
| if (!condition) { | |
| throw new IllegalArgumentException(message); |
| * 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>. |
There was a problem hiding this comment.
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).
| * <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>. |
No description provided.