private void simulateMethodHandle ( final InvokeDynamicInstruction instruction ) { final List < Element > arguments = IntStream . range ( 0 , instruction . getDynamicIdentifier ( ) . getParameters ( ) . size ( ) ) . mapToObj ( t -> runtimeStack . pop ( ) ) . collect ( Collectors . toList ( ) ) ; Collections . reverse ( arguments ) ; if ( ! instruction . getDynamicIdentifier ( ) . isStaticMethod ( ) ) // first parameter is `this` arguments . remove ( 0 ) ; // adds the transferred arguments of the bootstrap call runtimeStack . push ( new MethodHandle ( instruction . getDynamicIdentifier ( ) . getReturnType ( ) , instruction . getIdentifier ( ) , arguments ) ) ; }
Simulates the invoke dynamic call . Pushes a method handle on the stack .