【发布时间】:2019-12-08 20:07:31
【问题描述】:
我在尝试这段代码时遇到 java.lang.StackOverflowError: stack size 8MB 错误,应用程序崩溃了 1 次,现在它不会再次崩溃,我想知道这是否会导致在提交此代码之前将来有任何问题
以下是本部分使用的接口/数据类的示例
interface y{
val image
}
data class x(val anotherImage): y{
override val image
get() = image ?: anotherImage
}
我在这里想要的是让 val 图像包含图像的 URL,有时后端在 image 中返回它,有时在 anotherImage 中返回它,这就是我写那段代码的原因,在这里使用接口是针对与这个问题无关的另一个问题
【问题讨论】:
标签: android oop kotlin properties data-class