Fix java 8 build

This commit is contained in:
Andrea Cavalli 2023-08-30 11:57:13 +02:00
parent 6e7f82fa95
commit db8676cb6d
3 changed files with 22 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import it.tdlight.ResultHandler;
import it.tdlight.TelegramClient;
import it.tdlight.jni.TdApi.Message;
import it.tdlight.jni.TdApi.Update;
import it.tdlight.util.FutureSupport;
import it.tdlight.util.UnsupportedNativeLibraryException;
import it.tdlight.jni.TdApi;
import it.tdlight.jni.TdApi.ChatListArchive;
@ -359,7 +360,7 @@ public final class SimpleTelegramClient implements Authenticable, MutableTelegra
* Wait until TDLight is closed
*/
public CompletableFuture<Void> waitForExitAsync() {
return closed.copy();
return FutureSupport.copy(closed);
}
private void onCloseUpdate() {

View File

@ -0,0 +1,10 @@
package it.tdlight.util;
import java.util.concurrent.CompletableFuture;
public class FutureSupport {
public static <T> CompletableFuture<T> copy(CompletableFuture<T> future) {
return CompletableFuture.completedFuture(true).thenCompose(ignored -> future);
}
}

View File

@ -0,0 +1,10 @@
package it.tdlight.util;
import java.util.concurrent.CompletableFuture;
public class FutureSupport {
public static <T> CompletableFuture<T> copy(CompletableFuture<T> future) {
return future.copy();
}
}