Fix various issues for the native distributions

This commit is contained in:
Christopher Schnick
2022-01-31 12:13:27 +01:00
parent 41837479fc
commit cb8f1239ad
26 changed files with 208 additions and 199 deletions
@@ -37,7 +37,7 @@ public class CoreJacksonModule extends SimpleModule {
addSerializer(Path.class, new LocalPathSerializer());
addDeserializer(Path.class, new LocalPathDeserializer());
context.setMixInAnnotations(Throwable.class, ExceptionTypeMixIn.class);
context.setMixInAnnotations(Throwable.class, ThrowableTypeMixIn.class);
}
public static class CharsetSerializer extends JsonSerializer<Charset> {
@@ -75,8 +75,6 @@ public class CoreJacksonModule extends SimpleModule {
}
@JsonSerialize(as = Throwable.class)
public abstract static class ExceptionTypeMixIn {
public abstract static class ThrowableTypeMixIn {
}
}
@@ -14,7 +14,11 @@ public class JacksonHelper {
private static final ObjectMapper INSTANCE = new ObjectMapper();
private static boolean init = false;
public static synchronized void init(ModuleLayer layer) {
public static synchronized void initClassBased() {
initModularized(null);
}
public static synchronized void initModularized(ModuleLayer layer) {
ObjectMapper objectMapper = INSTANCE;
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
@@ -30,7 +34,8 @@ public class JacksonHelper {
private static List<Module> findModules(ModuleLayer layer) {
ArrayList<Module> modules = new ArrayList<Module>();
ServiceLoader<Module> loader = ServiceLoader.load(layer, Module.class);
ServiceLoader<Module> loader = layer != null ?
ServiceLoader.load(layer, Module.class) : ServiceLoader.load(Module.class);
for (Module module : loader) {
modules.add(module);
}
+1 -1
View File
@@ -3,7 +3,6 @@ import io.xpipe.core.util.CoreJacksonModule;
module io.xpipe.core {
requires com.fasterxml.jackson.core;
requires com.fasterxml.jackson.databind;
requires com.fasterxml.jackson.module.paramnames;
requires static lombok;
@@ -17,6 +16,7 @@ module io.xpipe.core {
opens io.xpipe.core.data.type;
opens io.xpipe.core.data.generic;
exports io.xpipe.core.util;
opens io.xpipe.core.util;
exports io.xpipe.core.data.node;
opens io.xpipe.core.data.node;
exports io.xpipe.core.data.typed;