mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -10,7 +10,8 @@ import java.util.concurrent.*
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.function.Consumer
|
||||
|
||||
open class AsyncPromise<T> private constructor(private val f: CompletableFuture<T>, private val hasErrorHandler: AtomicBoolean) : CancellablePromise<T>, InternalPromiseUtil.CompletablePromise<T> {
|
||||
open class AsyncPromise<T> private constructor(private val f: CompletableFuture<T>,
|
||||
private val hasErrorHandler: AtomicBoolean) : CancellablePromise<T>, InternalPromiseUtil.CompletablePromise<T> {
|
||||
constructor() : this(CompletableFuture(), AtomicBoolean())
|
||||
|
||||
override fun isDone() = f.isDone
|
||||
|
||||
@@ -19,15 +19,10 @@ abstract class CommandSenderBase<SUCCESS_RESPONSE> {
|
||||
class RequestPromise<SUCCESS_RESPONSE, RESULT : Any?>(private val methodName: String?) : AsyncPromise<RESULT>(), RequestCallback<SUCCESS_RESPONSE> {
|
||||
override fun onSuccess(response: SUCCESS_RESPONSE?, resultReader: ResultReader<SUCCESS_RESPONSE>?) {
|
||||
catchError {
|
||||
val r: Any?
|
||||
if (resultReader == null || response == null) {
|
||||
r = response
|
||||
}
|
||||
else if (methodName == null) {
|
||||
r = null
|
||||
}
|
||||
else {
|
||||
r = resultReader.readResult(methodName, response)
|
||||
val r = when {
|
||||
resultReader == null || response == null -> response
|
||||
methodName == null -> null
|
||||
else -> resultReader.readResult(methodName, response)
|
||||
}
|
||||
|
||||
UnsafeSetResult.setResult(this, r)
|
||||
|
||||
Reference in New Issue
Block a user