ASM字节码:Lambda表达式内容在哪里

时间:2018-11-07 12:53:06

标签: java bytecode java-bytecode-asm

在这种情况下,我正在字节码中搜索lambda表达式的内容,以寻找wait(100,elem)。我没有找到包含该代码的其他类文件。

Java:

public void main() throws Exception{

    wait(100, 1);

    wait(100, 2);

    Stream.of(1,2,3).forEach(c(elem ->  {
        wait(100, elem);
    }));

    for (int i = 1; i <3; i++){
        wait(100, i);
    }
}

字节码:

Code:
   0: aload_0
   1: bipush        100
   3: iconst_1
   4: invokevirtual #4                  // Method wait:(II)V
   7: aload_0
   8: bipush        100
  10: iconst_2
  11: invokevirtual #4                  // Method wait:(II)V
  14: iconst_3
  15: anewarray     #5                  // class java/lang/Integer
  18: dup
  19: iconst_0
  20: iconst_1
  21: invokestatic  #6                  // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
  24: aastore
  25: dup
  26: iconst_1
  27: iconst_2
  28: invokestatic  #6                  // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
  31: aastore
  32: dup
  33: iconst_2
  34: iconst_3
  35: invokestatic  #6                  // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
  38: aastore
  39: invokestatic  #7                  // InterfaceMethod java/util/stream/Stream.of:([Ljava/lang/Object;)Ljava/util/stream/Stream;
  42: aload_0
  43: invokedynamic #8,  0              // InvokeDynamic #0:accept:(Lorg/workflow/LambdaWorkflow;)Lorg/objects/LambdaUtil$ThrowingConsumer;
  48: invokestatic  #9                  // Method org/objects/LambdaUtil.c:(Lorg/objects/LambdaUtil$ThrowingConsumer;)Ljava/util/function/Consumer;
  51: invokeinterface #10,  2           // InterfaceMethod java/util/stream/Stream.forEach:(Ljava/util/function/Consumer;)V
  56: iconst_1
  57: istore_1
  58: iload_1
  59: iconst_3
  60: if_icmpge     76
  63: aload_0
  64: bipush        100
  66: iload_1
  67: invokevirtual #4                  // Method wait:(II)V
  70: iinc          1, 1
  73: goto          58
  76: return

是否有包含表达式内指令的特殊文件?

0 个答案:

没有答案