From 4171577bf0659bdcb133b9e522e578e0a002265c Mon Sep 17 00:00:00 2001 From: Vaci Koblizek Date: Sun, 6 Mar 2022 14:08:13 +0000 Subject: [PATCH] Move NULL and BROKEN brands to ClientHook --- runtime/src/main/java/org/capnproto/Capability.java | 6 +++--- runtime/src/main/java/org/capnproto/ClientHook.java | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/runtime/src/main/java/org/capnproto/Capability.java b/runtime/src/main/java/org/capnproto/Capability.java index 8fc0f7a..722f478 100644 --- a/runtime/src/main/java/org/capnproto/Capability.java +++ b/runtime/src/main/java/org/capnproto/Capability.java @@ -5,10 +5,10 @@ import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; -public final class Capability { +import static org.capnproto.ClientHook.BROKEN_CAPABILITY_BRAND; +import static org.capnproto.ClientHook.NULL_CAPABILITY_BRAND; - static final Object NULL_CAPABILITY_BRAND = new Object(); - static final Object BROKEN_CAPABILITY_BRAND = new Object(); +public final class Capability { public static class BuilderContext { public CapTableBuilder capTable; diff --git a/runtime/src/main/java/org/capnproto/ClientHook.java b/runtime/src/main/java/org/capnproto/ClientHook.java index d04e125..5f4cdb4 100644 --- a/runtime/src/main/java/org/capnproto/ClientHook.java +++ b/runtime/src/main/java/org/capnproto/ClientHook.java @@ -5,6 +5,8 @@ import java.util.concurrent.CompletableFuture; public interface ClientHook { + static final Object NULL_CAPABILITY_BRAND = new Object(); + static final Object BROKEN_CAPABILITY_BRAND = new Object(); /** * Start a new call, allowing the client to allocate request/response objects as it sees fit. * This version is used when calls are made from application code in the local process. @@ -70,14 +72,14 @@ public interface ClientHook { * reading a null pointer out of a Cap'n Proto message. */ default boolean isNull() { - return getBrand() == Capability.NULL_CAPABILITY_BRAND; + return getBrand() == NULL_CAPABILITY_BRAND; } /** * Returns true if the capability was created by newBrokenCap(). */ default boolean isError() { - return getBrand() == Capability.BROKEN_CAPABILITY_BRAND; + return getBrand() == BROKEN_CAPABILITY_BRAND; } /**