@ Override @ Trivial public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { if ( "addTransformer" . equals ( method . getName ( ) ) ) { addTransformer ( ( ClassFileTransformer ) args [ 0 ] , args . length > 1 ? ( Boolean ) args [ 1 ] : false ) ; return null ; } if ( "removeTransformer" . equals ( method . getName ( ) ) ) { return removeTransformer ( ( ClassFileTransformer ) args [ 0 ] ) ; } if ( "appendToBootstrapClassLoaderSearch" . equals ( method . getName ( ) ) ) { appendToBootstrapClassLoaderSearch ( ( JarFile ) args [ 0 ] ) ; return null ; } if ( "appendToSystemClassLoaderSearch" . equals ( method . getName ( ) ) ) { appendToSystemClassLoaderSearch ( ( JarFile ) args [ 0 ] ) ; return null ; } if ( "setNativeMethodPrefix" . equals ( method . getName ( ) ) ) { setNativeMethodPrefix ( ( ClassFileTransformer ) args [ 0 ] , ( String ) args [ 1 ] ) ; return null ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , method . getName ( ) , args ) ; } Object retValue = method . invoke ( instrumentation , args ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { if ( void . class == method . getReturnType ( ) ) { Tr . exit ( tc , method . getName ( ) ) ; } else { Tr . exit ( tc , method . getName ( ) , retValue ) ; } } return retValue ; }
If this method is traced it can call proxy . toString which causes another invoke call leading to an infinite loop .