add override to set clients from completablefutures

This commit is contained in:
Vaci Koblizek 2020-11-09 21:43:32 +00:00
parent c30dba3e9f
commit dcd9eb37c7
3 changed files with 7 additions and 4 deletions

View file

@ -1137,6 +1137,9 @@ private:
spaces(indent), " }\n",
spaces(indent), " public void set", titleCase, "(", serverType, " value) {\n",
spaces(indent), " this.set", titleCase, "(new ", clientType, "(value));\n",
spaces(indent), " }\n",
spaces(indent), " public void set", titleCase, "(java.util.concurrent.CompletableFuture<? extends ", clientType, "> value) {\n",
spaces(indent), " this.set", titleCase, "(new ", clientType, "(value));\n",
spaces(indent), " }\n"
),
@ -1825,7 +1828,7 @@ private:
sp, " public Client(org.capnproto.ClientHook hook) { super(hook); }\n",
sp, " public Client(org.capnproto.Capability.Client cap) { super(cap); }\n",
sp, " public Client(Server server) { super(server); }\n",
sp, " public <T extends Client> Client(java.util.concurrent.CompletionStage<T> promise) {\n",
sp, " public Client(java.util.concurrent.CompletionStage<? extends Client> promise) {\n",
sp, " super(promise);\n",
sp, " }\n",
sp, " public static final class Methods {\n",

View file

@ -484,7 +484,7 @@ public class RpcTest {
{
var req = client.holdRequest();
req.getParams().setCap(new Test.TestInterface.Client(paf));
req.getParams().setCap(paf);
req.send().join();
}

View file

@ -117,9 +117,9 @@ public final class Capability {
this.hook = hook;
}
public <T extends Client> Client(CompletionStage<T> promise) {
public Client(CompletionStage<? extends Client> promise) {
this(Capability.newLocalPromiseClient(
promise.thenApply(client -> client.getHook())));
promise.thenApply(Client::getHook)));
}
public Client(Throwable exc) {