groostav
02/07/2018, 7:19 PMpublic static T await(Future<T> future) that used Toolkit.enter/exitNestedEventLoop in java to create what is a kind of stackful coroutine. There are a number of problems with this strategy and I do not recomend it.
But the problem now is that we have a whole bunch of java code, written in an imperative style, that was accidentally using coroutines. Retrofitting it to use CompeltableFuture.whenComplete properly would be a fairly serious time investment. Its easier for us to just ctrl + alt + k the set of ~5 classes, and throw suspend infront of the methods where appropriate. Then uses of my custom public static T await(Future<T> future) with kotlinx's extension functions.