@JsonClass can't be applied to [class], RealmObject is not Kotlin typepublic

i bumped on a problem with setting up my Realm instances with Moshi annotations. Haven’t found any similar problems.

Model classes below


@JsonClass(generateAdapter = true)
open class FormField(

    private var fieldId: String? = null,
    private var fieldName: String? = null,
    private var fieldType: String? = null,
    private var isRequired: Boolean? = null
): RealmObject()

Form.kt @JsonClass(generateAdapter = true) open class Form(

    private var formFields: RealmList<FormField>? = null,
    private var name: Boolean? = null,
    private var description: Boolean? = null,
    private var error: Boolean? = null,
    private var message: String? = null,
    private var status: String? = null
): RealmObject()

And errors im receiving

@JsonClass can't be applied to com.example.dynamicforms.data.entity.Form: supertype io.realm.RealmObject is not a Kotlin type
public class Form extends io.realm.RealmObject {

@JsonClass can't be applied to com.example.dynamicforms.data.entity.FormField: supertype io.realm.RealmObject is not a Kotlin type
public class FormField extends io.realm.RealmObject {

Thanks in advance for any help :)


Code compiles after deleting @JsonClass(generateAdapter = true), but isn’t it harm since im removing my adapter. For what i know it was taking care of reflection. Hopefully it won’t be problem in future.


上一篇 2022年6月29日 下午3:56
下一篇 2022年6月29日 下午3:56