From 0cae1208b1b0e359a2b50cc8143b5d5bc9e5fd0c Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 21 Jun 2023 14:40:58 +0200 Subject: [PATCH] Remove BindingReflections.isRpcMethod() This method is not used anywhere, remove it. JIRA: MDSAL-781 Change-Id: I706eac66d496ae8f52c9a98b004d1906e6165e43 Signed-off-by: Robert Varga --- .../spec/reflect/BindingReflections.java | 19 ------------------- .../spec/reflect/BindingReflectionsTest.java | 2 -- 2 files changed, 21 deletions(-) diff --git a/binding/mdsal-binding-spec-util/src/main/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflections.java b/binding/mdsal-binding-spec-util/src/main/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflections.java index b3c9be6eea..be9704c2de 100644 --- a/binding/mdsal-binding-spec-util/src/main/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflections.java +++ b/binding/mdsal-binding-spec-util/src/main/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflections.java @@ -14,7 +14,6 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; -import com.google.common.util.concurrent.ListenableFuture; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -30,7 +29,6 @@ import org.opendaylight.yangtools.yang.binding.DataContainer; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.Notification; import org.opendaylight.yangtools.yang.binding.Rpc; -import org.opendaylight.yangtools.yang.binding.RpcService; import org.opendaylight.yangtools.yang.binding.YangModuleInfo; import org.opendaylight.yangtools.yang.binding.contract.Naming; import org.opendaylight.yangtools.yang.common.QName; @@ -62,23 +60,6 @@ public final class BindingReflections { return CLASS_TO_QNAME.getUnchecked(dataType).orElse(null); } - /** - * Checks if method is RPC invocation. - * - * @param possibleMethod - * Method to check - * @return true if method is RPC invocation, false otherwise. - */ - public static boolean isRpcMethod(final Method possibleMethod) { - return possibleMethod != null && RpcService.class.isAssignableFrom(possibleMethod.getDeclaringClass()) - && ListenableFuture.class.isAssignableFrom(possibleMethod.getReturnType()) - // length <= 2: it seemed to be impossible to get correct RpcMethodInvoker because of - // resolveRpcInputClass() check.While RpcMethodInvoker counts with one argument for - // non input type and two arguments for input type, resolveRpcInputClass() counting - // with zero for non input and one for input type - && possibleMethod.getParameterCount() <= 2; - } - public static @NonNull QName getQName(final BaseIdentity identity) { return getContractQName(identity); } diff --git a/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflectionsTest.java b/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflectionsTest.java index 066a293bec..83b1961555 100644 --- a/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflectionsTest.java +++ b/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflectionsTest.java @@ -28,8 +28,6 @@ public class BindingReflectionsTest { assertTrue("Should be BindingClass", BindingReflections.isBindingClass(DataObject.class)); assertFalse("Should not be Notification", BindingReflections.isNotification(DataObject.class)); - assertTrue(BindingReflections.isRpcMethod(TestImplementation.class.getDeclaredMethod("rpcMethodTest"))); - assertEquals(QName.create("test", "test"), BindingReflections.getQName(TestIdentity.VALUE)); } -- 2.36.6