解决被代理类实现了范型参数方法情况下aop代理报错的问题.

This commit is contained in:
aoshiguchen
2022-07-06 17:04:35 +08:00
parent 2e76fd52db
commit e5690521b4
2 changed files with 28 additions and 1 deletions
@@ -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);
@@ -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<String,String>{
public void handle(String s, String s2) {
System.out.println("hello");
}
public void a() {
}
}
}