Dico
04/02/2019, 5:32 PMpublic interface SingleResultCallback<T> {
/**
* Called when the operation completes.
* @param result the result, which may be null. Always null if e is not null.
* @param t the throwable, or null if the operation completed normally
*/
void onResult(T result, Throwable t);
}
I want to implement this by wrapping a Continuation<T>
- and I want the type parameter to be in invariant position.
class CallbackImpl<in T>(val cont: Continuation<T>) : SingleResultCallback<T> {
override fun onResult(result: T, error: Throwable?) {
if (error != null) {
cont.resumeWithException(error)
} else {
cont.resume(result)
}
}
}
However, the in
produces an error when I try to implement SingleResultCallbackPavlo Liapota
04/02/2019, 6:52 PM