当我使用jdk动态代理时,似乎
Object proxy = Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
new Class<?>[] { xx }, handler);
当我调试程序时,一步步跳过, 处理程序变体将使用“toString”方法调用其方法
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
}
if (method.getName().equals("toString")){
System.out.println( " toString " +args);//**executed every step over line,why??**
return method.invoke(target,args);
}
但非 Debug模式时没有问题。
最佳答案
关于java - 为什么jdk动态代理在debug每一步模式时都会调用InvocableHandler.invoke "toString"方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46292536/