I'm trying to de-serialise from json created by moshi-jsonapi and I am getting an exception:
Caused by: java.lang.IllegalAccessException: Cannot set public final static field long io.zinda.domain.jsonapi.UserJson.serialVersionUID of class java.lang.Class<io.zinda.domain.jsonapi.UserJson>
at java.lang.reflect.Field.set(Native Method)
at moe.banana.jsonapi2.Resource$Binding.set(Resource.java:309)
at moe.banana.jsonapi2.Resource$Adapter.fromJson(Resource.java:171)
at moe.banana.jsonapi2.Resource$Adapter.fromJson(Resource.java:80)
at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:33)
at moe.banana.jsonapi2.ResourceAdapterFactory.polymorphicFromJson(ResourceAdapterFactory.java:117)
at moe.banana.jsonapi2.ResourceAdapterFactory.access$300(ResourceAdapterFactory.java:13)
at moe.banana.jsonapi2.ResourceAdapterFactory$Adapter.fromJson(ResourceAdapterFactory.java:162)
at moe.banana.jsonapi2.ResourceAdapterFactory$Adapter.fromJson(ResourceAdapterFactory.java:129)
at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:33)
at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:37)
It looks like the Resource.Adaper should be ignoring static fields, but it should not. Starting around line 96 of Resource.java we have:
if (Modifier.isTransient(modifiers)) {
continue;
}
It should probably read:
if (Modifier.isTransient(modifiers) || Modifier.isStatic(modifiers)) {
continue;
}
I'm trying to de-serialise from json created by moshi-jsonapi and I am getting an exception:
It looks like the Resource.Adaper should be ignoring static fields, but it should not. Starting around line 96 of Resource.java we have:
It should probably read: