mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:10:43 +07:00
clean up after conversion to Kotlin
GitOrigin-RevId: 482389d8ca2bfeff0fc305db3ba8dd639484f06d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
48a3a130e7
commit
53d6cb8409
@@ -5,12 +5,12 @@ import kotlinx.coroutines.CompletableJob
|
||||
import java.util.function.BiConsumer
|
||||
|
||||
internal class CancellationBiConsumer<T, U>(
|
||||
private val myJob: CompletableJob,
|
||||
private val myRunnable: BiConsumer<T, U>,
|
||||
) : BiConsumer<T, U> {
|
||||
private val job: CompletableJob,
|
||||
private val runnable: BiConsumer<T, U>,
|
||||
) : BiConsumer<T, U> {
|
||||
override fun accept(t: T, u: U) {
|
||||
runAsCoroutine(myJob) {
|
||||
myRunnable.accept(t, u)
|
||||
runAsCoroutine(job) {
|
||||
runnable.accept(t, u)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,13 @@ import java.util.concurrent.Callable
|
||||
* @see CancellationRunnable
|
||||
*/
|
||||
internal class CancellationCallable<V>(
|
||||
private val myJob: CompletableJob,
|
||||
private val myCallable: Callable<out V>,
|
||||
) : Callable<V> {
|
||||
private val job: CompletableJob,
|
||||
private val callable: Callable<out V>,
|
||||
) : Callable<V> {
|
||||
|
||||
override fun call(): V {
|
||||
return runAsCoroutine(myJob) {
|
||||
myCallable.call()
|
||||
return runAsCoroutine(job) {
|
||||
callable.call()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,17 +7,17 @@ import java.util.function.Function
|
||||
|
||||
@ApiStatus.Internal
|
||||
class CancellationFunction<T, U> internal constructor(
|
||||
private val myJob: CompletableJob,
|
||||
private val myFunction: Function<T, U>,
|
||||
) : Function<T, U> {
|
||||
private val job: CompletableJob,
|
||||
private val function: Function<T, U>,
|
||||
) : Function<T, U> {
|
||||
|
||||
override fun apply(t: T): U {
|
||||
return runAsCoroutine(myJob) {
|
||||
myFunction.apply(t)
|
||||
return runAsCoroutine(job) {
|
||||
function.apply(t)
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return myFunction.toString()
|
||||
return function.toString()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.util.concurrency
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
import java.lang.Runnable
|
||||
import kotlinx.coroutines.CompletableJob
|
||||
|
||||
/**
|
||||
* A Runnable, which, when run, associates the calling thread with a job,
|
||||
@@ -11,15 +10,15 @@ import java.lang.Runnable
|
||||
* @see CancellationCallable
|
||||
*/
|
||||
internal class CancellationRunnable(
|
||||
private val myJob: CompletableJob,
|
||||
private val myRunnable: Runnable,
|
||||
) : Runnable {
|
||||
private val job: CompletableJob,
|
||||
private val runnable: Runnable,
|
||||
) : Runnable {
|
||||
|
||||
override fun run() {
|
||||
runAsCoroutine(myJob, myRunnable)
|
||||
runAsCoroutine(job, runnable)
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return myRunnable.toString()
|
||||
return runnable.toString()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user