Skip to content

Instantly share code, notes, and snippets.

@eiennohito
Created August 12, 2015 11:44
Show Gist options
  • Save eiennohito/f05b420f64fa85186d7d to your computer and use it in GitHub Desktop.
Save eiennohito/f05b420f64fa85186d7d to your computer and use it in GitHub Desktop.
scala> :javap C
Size 727 bytes
MD5 checksum 2225b6d87689ff36f420cda073da0bb3
Compiled from "Test.scala"
public final class C extends B implements IA
minor version: 0
major version: 50
flags: ACC_PUBLIC, ACC_FINAL, ACC_SUPER
Constant pool:
#1 = Utf8 C
#2 = Class #1 // C
#3 = Utf8 B
#4 = Class #3 // B
#5 = Utf8 IA
#6 = Class #5 // IA
#7 = Utf8 Test.scala
#8 = Utf8 Lscala/reflect/ScalaSignature;
#9 = Utf8 bytes
#10 = Utf8 ??i1A!??? \t\t1IC??? aT- 9usz??aE??\r)?\"a????\tI!!????\t?\"aB?\n?1?!AA%B??q??\"????a?N\5u}Q\t??????!)!??C?'?\t1.F??!\t)?$D????9?!B:dC2 ?BA\r??\rIe?
#11 = Utf8 a
#12 = Utf8 ()I
#13 = Utf8 IA$class
#14 = Class #13 // IA$class
#15 = Utf8 (LIA;)I
#16 = NameAndType #11:#15 // a:(LIA;)I
#17 = Methodref #14.#16 // IA$class.a:(LIA;)I
#18 = Utf8 this
#19 = Utf8 LC;
#20 = Utf8 k
#21 = NameAndType #11:#12 // a:()I
#22 = Methodref #2.#21 // C.a:()I
#23 = Utf8 <init>
#24 = Utf8 ()V
#25 = NameAndType #23:#24 // "<init>":()V
#26 = Methodref #4.#25 // B."<init>":()V
#27 = Utf8 $init$
#28 = Utf8 (LIA;)V
#29 = NameAndType #27:#28 // $init$:(LIA;)V
#30 = Methodref #14.#29 // IA$class.$init$:(LIA;)V
#31 = Utf8 Code
#32 = Utf8 LocalVariableTable
#33 = Utf8 LineNumberTable
#34 = Utf8 SourceFile
#35 = Utf8 RuntimeVisibleAnnotations
#36 = Utf8 ScalaInlineInfo
#37 = Utf8 ScalaSig
{
public int a();
descriptor: ()I
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokestatic #17 // Method IA$class.a:(LIA;)I
4: ireturn
LocalVariableTable:
Start Length Slot Name Signature
0 5 0 this LC;
LineNumberTable:
line 18: 0
public final int k();
descriptor: ()I
flags: ACC_PUBLIC, ACC_FINAL
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokevirtual #22 // Method a:()I
4: ireturn
LocalVariableTable:
Start Length Slot Name Signature
0 5 0 this LC;
LineNumberTable:
line 19: 0
public C();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #26 // Method B."<init>":()V
4: aload_0
5: invokestatic #30 // Method IA$class.$init$:(LIA;)V
8: return
LocalVariableTable:
Start Length Slot Name Signature
0 9 0 this LC;
LineNumberTable:
line 18: 0
}
SourceFile: "Test.scala"
RuntimeVisibleAnnotations:
0: #8(#9=s#10)
Error: unknown attribute
ScalaInlineInfo: length = 0x13
01 01 00 03 00 17 00 18 01 00 0B 00 0C 01 00 14
00 0C 01
Error: unknown attribute
ScalaSig: length = 0x3
05 00 00
trait TA {
def a: Int
}
trait IA extends TA {
def a: Int = 5
}
abstract class B extends TA {
def c = a
}
final class C extends B with IA {
final def k = a
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment