Avoiding race conditions in Kotlin, Smartcast is impossible runtime exception The line: viewAdapter.setTitleData(bezinningModels) in the below snippet is giving me the runtime warning: Smart cast to 'BezinningAdapter' is impossible, because 'viewAdapter' is a mutable property that could have been changed by this time I went through a lot of posts with a similar runtime warning, and I understood why this happens. Basically Kotlin wants to avoid race conditions so that the value of a mutable object could not change,but still I do not get what I should do to avoid this mistake so that I can call the retrofit call into the RecyclerView Array I tried to change from var to val the value of RecyclerView but did not work RecyclerView Array var val RecyclerView Here the snippet that causes the problem: @RequiresApi(Build.VERSION_CODES.HONEYCOMB) class MainFragment : android.app.Fragment() private lateinit var viewManager: RecyclerView.LayoutManager private lateinit var...