我有一个数据类
@Entity(tableName = "type")
data class Type(
@PrimaryKey(autoGenerate = true) var id: Int = 0,
var type: Int = 0
)
编译项目时我收到消息
错误:房间不能选择一个构造函数,因为多个构造函数是合适的。
但是如果我将数据类更改为
@Entity(tableName = "type")
data class Type(
@PrimaryKey(autoGenerate = true) var id: Int = 0,
var type: String = ""
)
或java类
@Entity(tableName = "type")
public class Type {
@PrimaryKey(autoGenerate = true)
private int id;
private int type;
// getters and setters
}
它工作正常。是 Kotlin 错误还是其他什么?