1
0
mirror of synced 2026-10-17 21:06:13 +08:00

🎨 修复 GsonParser 与低版本 Gson 的兼容性问题

This commit is contained in:
Copilot
2025-11-17 11:11:51 +08:00
committed by GitHub
parent b8d2bb345a
commit 3c440eacb3
2 changed files with 50 additions and 3 deletions

View File

@@ -12,14 +12,14 @@ import java.io.Reader;
public class GsonParser {
public static JsonObject parse(String json) {
return JsonParser.parseString(json).getAsJsonObject();
return new JsonParser().parse(json).getAsJsonObject();
}
public static JsonObject parse(Reader json) {
return JsonParser.parseReader(json).getAsJsonObject();
return new JsonParser().parse(json).getAsJsonObject();
}
public static JsonObject parse(JsonReader json) {
return JsonParser.parseReader(json).getAsJsonObject();
return new JsonParser().parse(json).getAsJsonObject();
}
}