Fix polymorphic bug

This commit is contained in:
Andrea Cavalli 2021-05-21 01:56:39 +02:00
parent 424c3f1c45
commit 379326fd63

View File

@ -44,7 +44,7 @@ public abstract class MoshiPolymorphic<OBJ> {
private synchronized void initialize() { private synchronized void initialize() {
if (!this.initialized) { if (!this.initialized) {
this.initialized = true; this.initialized = true;
var abstractMoshiBuilder = new Moshi.Builder().add(new RecordsJsonAdapterFactory()); var abstractMoshiBuilder = new Moshi.Builder();
var abstractClasses = getAbstractClasses(); var abstractClasses = getAbstractClasses();
var concreteClasses = getConcreteClasses(); var concreteClasses = getConcreteClasses();
var extraAdapters = getExtraAdapters(); var extraAdapters = getExtraAdapters();
@ -67,6 +67,8 @@ public abstract class MoshiPolymorphic<OBJ> {
extraAdapters.forEach(abstractMoshiBuilder::add); extraAdapters.forEach(abstractMoshiBuilder::add);
abstractMoshiBuilder.add(new RecordsJsonAdapterFactory());
abstractMoshi = abstractMoshiBuilder.build(); abstractMoshi = abstractMoshiBuilder.build();
} }
} }