private static InsnList popMethodResult ( AbstractInsnNode invokeInsnNode ) { Validate . notNull ( invokeInsnNode ) ; Type returnType = getReturnTypeOfInvocation ( invokeInsnNode ) ; InsnList ret = new InsnList ( ) ; switch ( returnType . getSort ( ) ) { case Type . LONG : case Type . DOUBLE : ret . add ( new InsnNode ( Opcodes . POP2 ) ) ; break ; case Type . VOID : break ; case Type . METHOD : throw new IllegalStateException ( ) ; // this should never happen default : ret . add ( new InsnNode ( Opcodes . POP ) ) ; break ; } return ret ; }
Generates instructions to pop the result of the method off the stack . This will only generate instructions if the method being invoked generates a return value .