Android之提示type checking has run into a recrusive problem. Easiest workaround: specify types of your
1 问题
写kotlin的时候错误提示如下
type checking has run into a recrusive problem. Easiest workaround: specify types of your declarations explicitly
2 分析
我写得是递归函数如下,错误提示就是上面,是因为我们写返回值,才导致
suspend fun getWhiteUrlList(page: Int = 1, seq: Int = 0, dao: AdWhiteListBeanDao)= withContext(Dispatchers.IO) {
try {
if (page == 1) {
} else {
getWhiteUrlList(page, seq, dao)
}
} catch (e: Exception) {
false
}
}
3 解决办法
这个递归函数加上返回值就行
suspend fun getWhiteUrlList(page: Int = 1, seq: Int = 0, dao: AdWhiteListBeanDao): Boolean= withContext(Dispatchers.IO) {
try {
if (page == 1) {
true
} else {
getWhiteUrlList(page, seq, dao)
}
} catch (e: Exception) {
false
}
}
赞 (0)