CoroutineScope.coroutineContext deprecated, how do I do it now?

With coroutines library 0.24.0 I get this warning:

My code is like this:

job = launch(UI){

I want to launch sub-job inside of launch{}. This was child of parent job when coroutineContext was used as parameter. It’s deprecated, and I see only option to pass kotlin.coroutines.experimental.coroutineContext as parameter, which is long and ugly. Is there some other way, or how is this meant to work now?

Which coroutineContext are you currently importing if not the kotlin.coroutines.experimental.coroutineContext one?

I don’t import any, it uses those from kotlinx.coroutines.experimental.CoroutineScope.coroutineContext, and CoroutineScope is receiver parameter in coroutine block run by launch.

So these 2 have same name, and it automatically picks CoroutineScope.coroutineContext.

Are you by any chance using kotlin 1.3-M1? Because they are moving coroutiens out of the experimental package. There are some steps that need to be done for migration and calling code still compiled with the old experimental coroutines.
I can’t really tell you more because I did not yet try out the preview build of 1.3 myself. More info is here though:

    ext.kotlin_version = '1.2.60'

You have to import kotlin.coroutines.experimental.* or kotlin.coroutines.experimental.coroutineContext.
CoroutineScope.coroutineContext is now marked as LowPriorityInOverloadResolution and deprecated with replacement, so IDEA can even quickfix that for you: 2018-08-15_1112

Thanks, yes quickfix was able to fix this (add the import), so now it’s clear and solved.