【发布时间】:2018-05-13 15:42:28
【问题描述】:
我正在尝试使用房间并写下这个:
@Entity(foreignKeys = arrayOf(ForeignKey(entity = Category::class,
parentColumns = arrayOf("id"), childColumns = arrayOf("parentId"))))
data class Category (
val type: Byte,
val name: String,
val description: String,
var parentId: Long? = null,
var remoteId: Long? = null,
@PrimaryKey(autoGenerate = true)
val id: Long = 0L,
@Relation(parentColumn = "id", entityColumn = "parentId")
var subcategories: List<Category>? = null
)
但我得到了这个:
Error:Execution failed for task ':app:kaptDebugKotlin'.
> Internal compiler error. See log for more details
还有更多细节:
java.lang.IllegalStateException: failed to analyze:
java.lang.StackOverflowError
at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:57)
也许有人会遇到这个问题(因为没有子类别字段都可以正常工作)。
谢谢!
【问题讨论】:
标签: android database kotlin android-room