From 456eb9644b0d22e87cd521e5a75aabe112f08c0a Mon Sep 17 00:00:00 2001 From: thinkgem Date: Thu, 20 Jun 2024 17:56:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E6=B2=A1=E6=9C=89=E4=BC=A0=E9=80=92?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=B1=BB=E5=9E=8B=E5=B9=B6=E6=9C=89=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E9=87=8D=E8=BD=BD=E6=97=B6=EF=BC=8C=E9=9C=80=E4=BC=98?= =?UTF-8?q?=E5=85=88=E8=8E=B7=E5=8F=96=E6=97=A0=E5=8F=82=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/jeesite/common/reflect/asm/MethodAccess.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/src/main/java/com/jeesite/common/reflect/asm/MethodAccess.java b/common/src/main/java/com/jeesite/common/reflect/asm/MethodAccess.java index 0cad3111..6ce9edf2 100644 --- a/common/src/main/java/com/jeesite/common/reflect/asm/MethodAccess.java +++ b/common/src/main/java/com/jeesite/common/reflect/asm/MethodAccess.java @@ -47,6 +47,9 @@ public abstract class MethodAccess { /** Returns the index of the first method with the specified name. */ public int getIndex (String methodName) { + // 先查找无参数的方法,再查找有参数的方法,当未传递参数类型的时候,这是一个降级策略 + for (int i = 0, n = methodNames.length; i < n; i++) + if (methodNames[i].equals(methodName) && parameterTypes[i].length == 0) return i; for (int i = 0, n = methodNames.length; i < n; i++) if (methodNames[i].equals(methodName)) return i; throw new IllegalArgumentException("Unable to find non-private method: " + methodName);