1

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.

Jim Green
  • 1,088
  • 3
  • 15
  • 40

1 Answers1

0

enter image description here

I guess IDE need to display the info in the red box, this leads to invoking of the object's toString() method.

TT.
  • 15,774
  • 6
  • 47
  • 88
subfire
  • 11