学习Java8系列-Lambda (6)

我们再看下上面这个类反编译以后的情况

Classfile /Users/wangtongzhou/Documents/Java/learning/com/springboot2/learning/javabasic/java8/LambdaTest$$Lambda$1.class
  Last modified 2020-7-11; size 437 bytes
  MD5 checksum 729979930540708c60f4e71e63b69321
final class com.springboot2.learning.javabasic.java8.LambdaTest$$Lambda$1 implements com.springboot2.learning.javabasic.java8.Func
  minor version: 0
  major version: 52
  flags: ACC_FINAL, ACC_SUPER, ACC_SYNTHETIC
Constant pool:
   #1 = Utf8               com/springboot2/learning/javabasic/java8/LambdaTest$$Lambda$1
   #2 = Class              #1             // com/springboot2/learning/javabasic/java8/LambdaTest$$Lambda$1
   #3 = Utf8               java/lang/Object
   #4 = Class              #3             // java/lang/Object
   #5 = Utf8               com/springboot2/learning/javabasic/java8/Func
   #6 = Class              #5             // com/springboot2/learning/javabasic/java8/Func
   #7 = Utf8               <init>
   #8 = Utf8               ()V
   #9 = NameAndType        #7:#8          // "<init>":()V
  #10 = Methodref          #4.#9          // java/lang/Object."<init>":()V
  #11 = Utf8               add
  #12 = Utf8               (II)I
  #13 = Utf8               Ljava/lang/invoke/LambdaForm$Hidden;
  #14 = Utf8               com/springboot2/learning/javabasic/java8/LambdaTest
  #15 = Class              #14            // com/springboot2/learning/javabasic/java8/LambdaTest
  #16 = Utf8               lambda$main$0
  #17 = NameAndType        #16:#12        // lambda$main$0:(II)I
  #18 = Methodref          #15.#17        // com/springboot2/learning/javabasic/java8/LambdaTest.lambda$main$0:(II)I
  #19 = Utf8               Code
  #20 = Utf8               RuntimeVisibleAnnotations
{
  private com.springboot2.learning.javabasic.java8.LambdaTest$$Lambda$1();
    descriptor: ()V
    flags: ACC_PRIVATE
    Code:
      stack=1, locals=1, args_size=1
         0: aload_0
         1: invokespecial #10                 // Method java/lang/Object."<init>":()V
         4return

  public int add(intint);
    descriptor: (II)I
    flags: ACC_PUBLIC
    Code:
      stack=2, locals=3, args_size=3
         0: iload_1
         1: iload_2
         2: invokestatic  #18                 // Method com/springboot2/learning/javabasic/java8/LambdaTest.lambda$main$0:(II)I
         5: ireturn
    RuntimeVisibleAnnotations:
      0#13()
}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zwxfjx.html