[英]Why jdk dynamic proxy invoke InvocationHandler.invoke “toString” method when debug every step over mode
When I use jdk dynamic proxy ,seems当我使用 jdk 动态代理时,似乎
Object proxy = Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
new Class<?>[] { xx }, handler);
When I debug the program ,step over one by one, handler variant will invoke its method following with "toString" method当我调试程序时,一步一步来,处理程序变体将调用它的方法,并使用“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);
}
But it is is no problem when not debug mode.但是在非调试模式下是没有问题的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.