From dee4303ac65e1825d795bdf2359f35f7a3796e7e Mon Sep 17 00:00:00 2001 From: Vaci Koblizek Date: Wed, 28 Dec 2022 12:21:52 +0000 Subject: [PATCH] reduce the public interface for ClientHook --- .../main/java/org/capnproto/Capability.java | 14 ++------ .../main/java/org/capnproto/RpcException.java | 34 ------------------- 2 files changed, 3 insertions(+), 45 deletions(-) delete mode 100644 runtime/src/main/java/org/capnproto/RpcException.java diff --git a/runtime/src/main/java/org/capnproto/Capability.java b/runtime/src/main/java/org/capnproto/Capability.java index e1dd2ceb..0f69157d 100644 --- a/runtime/src/main/java/org/capnproto/Capability.java +++ b/runtime/src/main/java/org/capnproto/Capability.java @@ -6,22 +6,14 @@ public final class Capability { public static ClientHook newBrokenCap(String reason) { - return newBrokenClient(reason, false, BROKEN_CAPABILITY_BRAND); - } - - public static ClientHook newBrokenCap(Throwable exc) { - return newBrokenClient(exc, false, BROKEN_CAPABILITY_BRAND); + return newBrokenClient(BROKEN_CAPABILITY_BRAND); } public static ClientHook newNullCap() { - return newBrokenClient(RpcException.failed("Called null capability"), true, NULL_CAPABILITY_BRAND); - } - - private static ClientHook newBrokenClient(String reason, boolean resolved, Object brand) { - return newBrokenClient(RpcException.failed(reason), resolved, brand); + return newBrokenClient(NULL_CAPABILITY_BRAND); } - private static ClientHook newBrokenClient(Throwable exc, boolean resolved, Object brand) { + private static ClientHook newBrokenClient(Object brand) { return new ClientHook() { @Override public Object getBrand() { diff --git a/runtime/src/main/java/org/capnproto/RpcException.java b/runtime/src/main/java/org/capnproto/RpcException.java deleted file mode 100644 index 5f0184af..00000000 --- a/runtime/src/main/java/org/capnproto/RpcException.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.capnproto; - -public final class RpcException extends java.lang.Exception { - - public enum Type { - FAILED, - OVERLOADED, - DISCONNECTED, - UNIMPLEMENTED - } - - private final Type type; - - public RpcException(Type type, String message) { - super(message); - this.type = type; - } - - public final Type getType() { - return type; - } - - public static RpcException unimplemented(String message) { - return new RpcException(Type.UNIMPLEMENTED, message); - } - - public static RpcException failed(String message) { - return new RpcException(Type.FAILED, message); - } - - public static RpcException disconnected(String message) { - return new RpcException(Type.DISCONNECTED, message); - } -}