From e5690521b4697d97b53ca56adff8540cb5477211 Mon Sep 17 00:00:00 2001 From: aoshiguchen <1052045476@qq.com> Date: Wed, 6 Jul 2022 17:04:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=A2=AB=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E7=B1=BB=E5=AE=9E=E7=8E=B0=E4=BA=86=E8=8C=83=E5=9E=8B=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=96=B9=E6=B3=95=E6=83=85=E5=86=B5=E4=B8=8Baop?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/aop/proxy/AsgcProxyGenerator.java | 5 +++- .../core/aop/AsgcProxyGeneratorTest.java | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/proxy/AsgcProxyGenerator.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/proxy/AsgcProxyGenerator.java index fc21f9d4..bb70f07b 100644 --- a/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/proxy/AsgcProxyGenerator.java +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/proxy/AsgcProxyGenerator.java @@ -79,7 +79,10 @@ public class AsgcProxyGenerator { Method[] methods = targetType.getMethods(); if (ArrayUtil.notEmpty(methods)) { for (Method method : methods) { - if (Modifier.isFinal(method.getModifiers()) || Modifier.isStatic(method.getModifiers())) { + if (Modifier.isFinal(method.getModifiers()) || + Modifier.isStatic(method.getModifiers()) || + method.isSynthetic() + ) { continue; } Long methodId = ProxyCache.setMethod(method); diff --git a/neutrino-core/src/test/java/fun/asgc/neutrino/core/aop/AsgcProxyGeneratorTest.java b/neutrino-core/src/test/java/fun/asgc/neutrino/core/aop/AsgcProxyGeneratorTest.java index 2f7465cf..7102c1c7 100644 --- a/neutrino-core/src/test/java/fun/asgc/neutrino/core/aop/AsgcProxyGeneratorTest.java +++ b/neutrino-core/src/test/java/fun/asgc/neutrino/core/aop/AsgcProxyGeneratorTest.java @@ -22,8 +22,13 @@ package fun.asgc.neutrino.core.aop; import fun.asgc.neutrino.core.aop.proxy.AsgcProxyGenerator; +import fun.asgc.neutrino.core.base.Handler; import org.junit.Test; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + /** * * @author: aoshiguchen @@ -43,4 +48,23 @@ public class AsgcProxyGeneratorTest { System.out.println(result); } + @Test + public void test3() throws InvocationTargetException, IllegalAccessException { + Method[] methods = A.class.getDeclaredMethods(); + methods[0].invoke(new A(), "aa", "bb"); + System.out.println(methods[0].isSynthetic()); + } + + public static class A implements Handler{ + public void handle(String s, String s2) { + System.out.println("hello"); + } + + public void a() { + + } + + + } + }