如果我想使用moshi自动生成适配器,看起来不能添加与父类相同类型的字段
这是我的代码:
@JsonClass(generateAdapter = true)
class CommentModel: ListingItem() {
var id: String? = null
var body: String = ""
var created: String? = null
var score: Int = 0
.... // bunch of other fields
// this is the cause of my compilation error
var replies: List<CommentModel>? = null
}
项目无法编译,并显示以下消息:
error:[ComponentProcessor:MiscError] dagger.internal.codegen.ComponentProcessor was unable to process this interface because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.
我检查了生成的代码,没有循环依赖关系。如果删除replies
字段,则项目将成功编译。任何帮助将不胜感激:)