fix: prevent endlessly recursive serialization due to misinterpretation of checked method as getter
This commit is contained in:
parent
bcd4e34f7a
commit
0bd675fc7c
|
@ -1,5 +1,6 @@
|
|||
package io.gitlab.jfronny.inceptum.launcher.model.inceptum;
|
||||
|
||||
import io.gitlab.jfronny.gson.compile.annotations.GPrefer;
|
||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||
|
||||
|
@ -39,18 +40,21 @@ public class InstanceMeta {
|
|||
}
|
||||
|
||||
public void checkArguments() {
|
||||
arguments = arguments == null ? Arguments.EMPTY : arguments.checked();
|
||||
arguments = Arguments.checked(arguments);
|
||||
}
|
||||
|
||||
@GSerializable(configure = GsonPreset.Config.class)
|
||||
public record Arguments(List<String> jvm, List<String> client, List<String> server) {
|
||||
public static final Arguments EMPTY = new Arguments(List.of(), List.of(), List.of());
|
||||
|
||||
public Arguments checked() {
|
||||
@GPrefer public Arguments {}
|
||||
|
||||
public static Arguments checked(Arguments of) {
|
||||
if (of == null) return EMPTY;
|
||||
return new Arguments(
|
||||
jvm == null ? List.of() : jvm,
|
||||
client == null ? List.of() : client,
|
||||
server == null ? List.of() : server
|
||||
of.jvm == null ? List.of() : of.jvm,
|
||||
of.client == null ? List.of() : of.client,
|
||||
of.server == null ? List.of() : of.server
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue