Skip to content

Instantly share code, notes, and snippets.

@optician
Created May 17, 2018 06:49
Show Gist options
  • Save optician/faf62858ba4a58242c4295475d2da478 to your computer and use it in GitHub Desktop.
Save optician/faf62858ba4a58242c4295475d2da478 to your computer and use it in GitHub Desktop.
scala> object A1 { val a = 5 }
defined object A1
scala> object A2 { final val a = 5 }
defined object A2
scala> :javap A1$
Size 640 bytes
MD5 checksum 0d6b181ccd3f32e7e81a7f452b2f5686
Compiled from "<console>"
public class $line3.$read$$iw$$iw$A1$
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Utf8 $line3/$read$$iw$$iw$A1$
#2 = Class #1 // $line3/$read$$iw$$iw$A1$
#3 = Utf8 java/lang/Object
#4 = Class #3 // java/lang/Object
#5 = Utf8 <console>
#6 = Utf8 $line3/$read$$iw$
#7 = Class #6 // $line3/$read$$iw$
#8 = Utf8 $line3/$read
#9 = Class #8 // $line3/$read
#10 = Utf8 $iw$
#11 = Utf8 $line3/$read$$iw$$iw$
#12 = Class #11 // $line3/$read$$iw$$iw$
#13 = Utf8 A1$
#14 = Utf8 MODULE$
#15 = Utf8 L$line3/$read$$iw$$iw$A1$;
#16 = Utf8 a
#17 = Utf8 I
#18 = Utf8 <clinit>
#19 = Utf8 ()V
#20 = Utf8 <init>
#21 = NameAndType #20:#19 // "<init>":()V
#22 = Methodref #2.#21 // $line3/$read$$iw$$iw$A1$."<init>":()V
#23 = Utf8 ()I
#24 = NameAndType #16:#17 // a:I
#25 = Fieldref #2.#24 // $line3/$read$$iw$$iw$A1$.a:I
#26 = Utf8 this
#27 = Methodref #4.#21 // java/lang/Object."<init>":()V
#28 = NameAndType #14:#15 // MODULE$:L$line3/$read$$iw$$iw$A1$;
#29 = Fieldref #2.#28 // $line3/$read$$iw$$iw$A1$.MODULE$:L$line3/$read$$iw$$iw$A1$;
#30 = Utf8 Code
#31 = Utf8 LocalVariableTable
#32 = Utf8 LineNumberTable
#33 = Utf8 SourceFile
#34 = Utf8 InnerClasses
#35 = Utf8 ScalaInlineInfo
#36 = Utf8 Scala
{
public static $line3.$read$$iw$$iw$A1$ MODULE$;
descriptor: L$line3/$read$$iw$$iw$A1$;
flags: ACC_PUBLIC, ACC_STATIC
public static {};
descriptor: ()V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: new #2 // class $line3/$read$$iw$$iw$A1$
3: invokespecial #22 // Method "<init>":()V
6: return
public int a();
descriptor: ()I
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: getfield #25 // Field a:I
4: ireturn
LocalVariableTable:
Start Length Slot Name Signature
0 5 0 this L$line3/$read$$iw$$iw$A1$;
LineNumberTable:
line 11: 0
public $line3.$read$$iw$$iw$A1$();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=2, locals=1, args_size=1
0: aload_0
1: invokespecial #27 // Method java/lang/Object."<init>":()V
4: aload_0
5: putstatic #29 // Field MODULE$:L$line3/$read$$iw$$iw$A1$;
8: aload_0
9: iconst_5
10: putfield #25 // Field a:I
13: return
LocalVariableTable:
Start Length Slot Name Signature
0 14 0 this L$line3/$read$$iw$$iw$A1$;
LineNumberTable:
line 14: 0
line 11: 8
}
SourceFile: "<console>"
InnerClasses:
public static #10= #7 of #9; //$iw$=class $line3/$read$$iw$ of class $line3/$read
public static #10= #12 of #7; //$iw$=class $line3/$read$$iw$$iw$ of class $line3/$read$$iw$
public static #13= #2 of #12; //A1$=class $line3/$read$$iw$$iw$A1$ of class $line3/$read$$iw$$iw$
Error: unknown attribute
ScalaInlineInfo: length = 0xE
01 01 00 02 00 14 00 13 01 00 10 00 17 01
Error: unknown attribute
Scala: length = 0x0
scala> :javap A2$
Size 598 bytes
MD5 checksum 13f203d828ba55969318a16ccfc8222b
Compiled from "<console>"
public class $line4.$read$$iw$$iw$A2$
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Utf8 $line4/$read$$iw$$iw$A2$
#2 = Class #1 // $line4/$read$$iw$$iw$A2$
#3 = Utf8 java/lang/Object
#4 = Class #3 // java/lang/Object
#5 = Utf8 <console>
#6 = Utf8 $line4/$read$$iw$
#7 = Class #6 // $line4/$read$$iw$
#8 = Utf8 $line4/$read
#9 = Class #8 // $line4/$read
#10 = Utf8 $iw$
#11 = Utf8 $line4/$read$$iw$$iw$
#12 = Class #11 // $line4/$read$$iw$$iw$
#13 = Utf8 A2$
#14 = Utf8 MODULE$
#15 = Utf8 L$line4/$read$$iw$$iw$A2$;
#16 = Utf8 <clinit>
#17 = Utf8 ()V
#18 = Utf8 <init>
#19 = NameAndType #18:#17 // "<init>":()V
#20 = Methodref #2.#19 // $line4/$read$$iw$$iw$A2$."<init>":()V
#21 = Utf8 a
#22 = Utf8 ()I
#23 = Utf8 this
#24 = Methodref #4.#19 // java/lang/Object."<init>":()V
#25 = NameAndType #14:#15 // MODULE$:L$line4/$read$$iw$$iw$A2$;
#26 = Fieldref #2.#25 // $line4/$read$$iw$$iw$A2$.MODULE$:L$line4/$read$$iw$$iw$A2$;
#27 = Utf8 Code
#28 = Utf8 LocalVariableTable
#29 = Utf8 LineNumberTable
#30 = Utf8 SourceFile
#31 = Utf8 InnerClasses
#32 = Utf8 ScalaInlineInfo
#33 = Utf8 Scala
{
public static $line4.$read$$iw$$iw$A2$ MODULE$;
descriptor: L$line4/$read$$iw$$iw$A2$;
flags: ACC_PUBLIC, ACC_STATIC
public static {};
descriptor: ()V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: new #2 // class $line4/$read$$iw$$iw$A2$
3: invokespecial #20 // Method "<init>":()V
6: return
public final int a();
descriptor: ()I
flags: ACC_PUBLIC, ACC_FINAL
Code:
stack=1, locals=1, args_size=1
0: iconst_5
1: ireturn
LocalVariableTable:
Start Length Slot Name Signature
0 2 0 this L$line4/$read$$iw$$iw$A2$;
public $line4.$read$$iw$$iw$A2$();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #24 // Method java/lang/Object."<init>":()V
4: aload_0
5: putstatic #26 // Field MODULE$:L$line4/$read$$iw$$iw$A2$;
8: return
LocalVariableTable:
Start Length Slot Name Signature
0 9 0 this L$line4/$read$$iw$$iw$A2$;
LineNumberTable:
line 14: 0
line 11: 8
}
SourceFile: "<console>"
InnerClasses:
public static #10= #7 of #9; //$iw$=class $line4/$read$$iw$ of class $line4/$read
public static #10= #12 of #7; //$iw$=class $line4/$read$$iw$$iw$ of class $line4/$read$$iw$
public static #13= #2 of #12; //A2$=class $line4/$read$$iw$$iw$A2$ of class $line4/$read$$iw$$iw$
Error: unknown attribute
ScalaInlineInfo: length = 0xE
01 01 00 02 00 12 00 11 01 00 15 00 16 01
Error: unknown attribute
Scala: length = 0x0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment