1 problem

The following error message is displayed when writing kotlin

type checking has run into a recrusive problem. Easiest workaround: specify types of your declarations explicitly
Copy the code

2 analysis

I wrote a recursive function like this, and the error message is up here, because we wrote the return value

    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
        }
    }
Copy the code

3 Solutions

This recursive function plus the return value will do

    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
        }
    }
Copy the code