Skip to content

Commit 61acb95

Browse files
authored
Make DisposableHandle fun interface, remove our own adapter (#2790)
1 parent 17bc90b commit 61acb95

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

kotlinx-coroutines-core/api/kotlinx-coroutines-core.api

-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ public final class kotlinx/coroutines/Job$Key : kotlin/coroutines/CoroutineConte
367367
}
368368

369369
public final class kotlinx/coroutines/JobKt {
370-
public static final fun DisposableHandle (Lkotlin/jvm/functions/Function0;)Lkotlinx/coroutines/DisposableHandle;
371370
public static final fun Job (Lkotlinx/coroutines/Job;)Lkotlinx/coroutines/CompletableJob;
372371
public static final synthetic fun Job (Lkotlinx/coroutines/Job;)Lkotlinx/coroutines/Job;
373372
public static synthetic fun Job$default (Lkotlinx/coroutines/Job;ILjava/lang/Object;)Lkotlinx/coroutines/CompletableJob;

kotlinx-coroutines-core/common/src/Job.kt

+1-13
Original file line numberDiff line numberDiff line change
@@ -387,26 +387,14 @@ public fun Job0(parent: Job? = null): Job = Job(parent)
387387
/**
388388
* A handle to an allocated object that can be disposed to make it eligible for garbage collection.
389389
*/
390-
public interface DisposableHandle {
390+
public fun interface DisposableHandle {
391391
/**
392392
* Disposes the corresponding object, making it eligible for garbage collection.
393393
* Repeated invocation of this function has no effect.
394394
*/
395395
public fun dispose()
396396
}
397397

398-
/**
399-
* @suppress **This an internal API and should not be used from general code.**
400-
*/
401-
@Suppress("FunctionName")
402-
@InternalCoroutinesApi
403-
public inline fun DisposableHandle(crossinline block: () -> Unit): DisposableHandle =
404-
object : DisposableHandle {
405-
override fun dispose() {
406-
block()
407-
}
408-
}
409-
410398
// -------------------- Parent-child communication --------------------
411399

412400
/**

0 commit comments

Comments
 (0)