Kotlin “Smart cast est impossible, parce que la propriété pourrait avoir été modifié en ce moment”

Pourquoi Android Studio afficher le message d'erreur lorsque j'utilise le N ° 2 de script.
Je n'ai trouvé aucune différence entre 1 et 2.

class Adapter {
    var nameList : ArrayList<String>? = null
}

class Program {
    private fun send() {
        val list: ArrayList<String> = ArrayList()
        val adapter = Adapter()

//Case 1
        var otherList = adapter.nameList
        if (otherList != null) {
            list.addAll(otherList) //<--- no error
        }

//Case 2
        if (adapter.nameList!=null) {
            list.addAll(adapter.nameList) //<--- Error here
            //Smart cast to 'kotlin.collections.ArrayList<String> /* = java.util.ArrayList<String> */' is impossible, because 'adapter.nameList' is a mutable property that could have been changed by this time
        }
    }
}

Veuillez expliquer ce cas

OriginalL'auteur quangkid | 2017-10-12