构建房间期间发生 StackOverflowError
StackOverflowError during build room
我正在尝试使用房间并写下:
@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.WhosebugError
at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:57)
也许有人遇到这个问题(因为没有子类别字段一切正常)。
谢谢!
引用 the documentation for @Relation
:
Note that @Relation
annotation can be used only in Pojo classes, an Entity class cannot have relations.
理想情况下,您会得到比 WhosebugError
更好的构建错误,但您应该会得到某种形式的构建错误。
我正在尝试使用房间并写下:
@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.WhosebugError
at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:57)
也许有人遇到这个问题(因为没有子类别字段一切正常)。
谢谢!
引用 the documentation for @Relation
:
Note that
@Relation
annotation can be used only in Pojo classes, an Entity class cannot have relations.
理想情况下,您会得到比 WhosebugError
更好的构建错误,但您应该会得到某种形式的构建错误。