When I use jdk dynamic proxy ,seems
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
@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.
I guess IDE need to display the info in the red box, this leads to invoking of the object's
toString()
method.