From 379326fd6313719402c4d1dbbb6c542ef8ec75b8 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Fri, 21 May 2021 01:56:39 +0200 Subject: [PATCH] Fix polymorphic bug --- .../java/org/warp/commonutils/moshi/MoshiPolymorphic.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/warp/commonutils/moshi/MoshiPolymorphic.java b/src/main/java/org/warp/commonutils/moshi/MoshiPolymorphic.java index fcfe58f..6207cbf 100644 --- a/src/main/java/org/warp/commonutils/moshi/MoshiPolymorphic.java +++ b/src/main/java/org/warp/commonutils/moshi/MoshiPolymorphic.java @@ -44,7 +44,7 @@ public abstract class MoshiPolymorphic { private synchronized void initialize() { if (!this.initialized) { this.initialized = true; - var abstractMoshiBuilder = new Moshi.Builder().add(new RecordsJsonAdapterFactory()); + var abstractMoshiBuilder = new Moshi.Builder(); var abstractClasses = getAbstractClasses(); var concreteClasses = getConcreteClasses(); var extraAdapters = getExtraAdapters(); @@ -67,6 +67,8 @@ public abstract class MoshiPolymorphic { extraAdapters.forEach(abstractMoshiBuilder::add); + abstractMoshiBuilder.add(new RecordsJsonAdapterFactory()); + abstractMoshi = abstractMoshiBuilder.build(); } }