Skip to content

Commit

Permalink
Fix java 8 build
Browse files Browse the repository at this point in the history
  • Loading branch information
cavallium committed Aug 30, 2023
1 parent 6e7f82f commit db8676c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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;
Expand Down Expand Up @@ -359,7 +360,7 @@ public void waitForExit() throws InterruptedException {
* Wait until TDLight is closed
*/
public CompletableFuture<Void> waitForExitAsync() {
return closed.copy();
return FutureSupport.copy(closed);
}

private void onCloseUpdate() {
Expand Down
10 changes: 10 additions & 0 deletions tdlight-java/src/main/java/it/tdlight/util/FutureSupport.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
10 changes: 10 additions & 0 deletions tdlight-java/src/main/java11/it/tdlight/util/FutureSupport.java
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit db8676c

Please sign in to comment.