From d5cfd337566e01354520f426a10e4cebdd4c5b75 Mon Sep 17 00:00:00 2001 From: Roman Zhuravlev Date: Thu, 11 Dec 2025 18:09:51 +0500 Subject: [PATCH] Remove flexible method search --- .../java/org/zhdev/util/ReflectionUtils.java | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/common/src/main/java/org/zhdev/util/ReflectionUtils.java b/common/src/main/java/org/zhdev/util/ReflectionUtils.java index 900761e..e814526 100644 --- a/common/src/main/java/org/zhdev/util/ReflectionUtils.java +++ b/common/src/main/java/org/zhdev/util/ReflectionUtils.java @@ -7,7 +7,6 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Enumeration; import java.util.function.Consumer; @@ -33,20 +32,6 @@ public class ReflectionUtils { return constructor; } - private static boolean compareParameters(Class[] required, Class... parameters) { - if (required.length != parameters.length) { - return false; - } - - for (int i = 0; i < required.length; i++) { - if (!parameters[i].isAssignableFrom(required[i])) { - return false; - } - } - - return true; - } - private static Method checkMethodType(Method method, Class requiredType) throws IllegalStateException { if (requiredType == null || requiredType.isAssignableFrom(method.getReturnType())) return method; throw new IllegalStateException(requiredType + " is not assignable from type of " + method); @@ -113,16 +98,7 @@ public class ReflectionUtils { return checkMethodType(getMethod0(type, methodName, parameterTypes), returnType); } catch (IllegalStateException e) { exception = e; - } catch (NoSuchMethodException ignored) { - } - } - - if (parameterTypes.length > 0) { - for (Method m : type.getDeclaredMethods()) { - if (compareParameters(parameterTypes, m.getParameterTypes())) { - return checkMethodType(m, returnType); - } - } + } catch (NoSuchMethodException ignored) {} } if (exception != null) {