Skip to content

Commit 2adde03

Browse files
committed
Fix: Unable to invoke no-args constructor for interface org.maxgamer.quickshop.api.shop.ShopModerator. Register an InstanceCreator with Gson for this type may fix this problem. (caused by Helper's Gson issue)
1 parent f37ba3f commit 2adde03

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/main/java/org/maxgamer/quickshop/shop/JavaShopModerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public JavaShopModerator(@NotNull UUID owner, @NotNull List<UUID> staffs) {
6969

7070
public static ShopModerator deserialize(@NotNull String serilized) throws JsonSyntaxException {
7171
// Use Gson deserialize data
72-
Gson gson = JsonUtil.getGson();
72+
Gson gson = JsonUtil.regular();
7373
return gson.fromJson(serilized, ShopModerator.class);
7474
}
7575

src/main/java/org/maxgamer/quickshop/util/JsonUtil.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
* @author Ghost_chu and sandtechnology, modified based on Lucko's Helper project
3838
*/
3939
public final class JsonUtil {
40+
private static final Gson REGULAR_GSON = new Gson();
4041
private static final Gson STANDARD_GSON = GsonComponentSerializer.populate(new GsonBuilder())
4142
.registerTypeHierarchyAdapter(DataTree.class, JsonElementTreeSerializer.INSTANCE)
4243
.registerTypeAdapterFactory(GsonSerializableAdapterFactory.INSTANCE)
@@ -60,6 +61,10 @@ public final class JsonUtil {
6061

6162
private static final JsonParser PARSER = new JsonParser();
6263

64+
public static Gson regular() {
65+
return REGULAR_GSON;
66+
}
67+
6368
@Nonnull
6469
public static Gson standard() {
6570
return STANDARD_GSON;

0 commit comments

Comments
 (0)