Skip to content

Commit

Permalink
Fix RuntimeTypeAdapterFactory
Browse files Browse the repository at this point in the history
Trying to use this class as is results in the type-property not being serialized into the JSON, thus it is not present on deserialization.
The fix from #712 (comment) works. No idea why this is not merged yet.
  • Loading branch information
t-oster authored and Thomas Oster committed Jun 28, 2022
1 parent c79b6e3 commit 4f45e74
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public RuntimeTypeAdapterFactory<T> registerSubtype(Class<? extends T> type) {

@Override
public <R> TypeAdapter<R> create(Gson gson, TypeToken<R> type) {
if (type.getRawType() != baseType) {
if (null == type || !baseType.isAssignableFrom(type.getRawType())) {
return null;
}

Expand Down

0 comments on commit 4f45e74

Please sign in to comment.