$ cat examples/Hello.java
class Hello {
public static void main(String[] args) {
long l = 123534l;
double x = 2.31;
System.out.println("Hello World");
}
}
$ javac examples/Hello.java
$ cargo run examples/Hello.class
cafebabe!
version: minor: 0, major: 52
constant_pool_count: 33
tag(1): Methodref: MethodrefInfo { class_index: 10, name_and_type_index: 19 }
tag(2): Long: LongInfo { i: 123534 }
tag(4): Double: DoubleInfo { f: 2.31 }
tag(6): Fieldref: FieldrefInfo { class_index: 20, name_and_type_index: 21 }
tag(7): String: String { string_index: 22 }
tag(8): Methodref: MethodrefInfo { class_index: 23, name_and_type_index: 24 }
tag(9): Class: ClassInfo { name_index: 25 }
tag(10): Class: ClassInfo { name_index: 26 }
tag(11): Utf8: Utf8 { s: "<init>" }
tag(12): Utf8: Utf8 { s: "()V" }
tag(13): Utf8: Utf8 { s: "Code" }
tag(14): Utf8: Utf8 { s: "LineNumberTable" }
tag(15): Utf8: Utf8 { s: "main" }
tag(16): Utf8: Utf8 { s: "([Ljava/lang/String;)V" }
tag(17): Utf8: Utf8 { s: "SourceFile" }
tag(18): Utf8: Utf8 { s: "Hello.java" }
tag(19): NameAndType: NameAndTypeInfo { name_index: 11, descriptor_index: 12 }
tag(20): Class: ClassInfo { name_index: 27 }
tag(21): NameAndType: NameAndTypeInfo { name_index: 28, descriptor_index: 29 }
tag(22): Utf8: Utf8 { s: "Hello World" }
tag(23): Class: ClassInfo { name_index: 30 }
tag(24): NameAndType: NameAndTypeInfo { name_index: 31, descriptor_index: 32 }
tag(25): Utf8: Utf8 { s: "Hello" }
tag(26): Utf8: Utf8 { s: "java/lang/Object" }
tag(27): Utf8: Utf8 { s: "java/lang/System" }
tag(28): Utf8: Utf8 { s: "out" }
tag(29): Utf8: Utf8 { s: "Ljava/io/PrintStream;" }
tag(30): Utf8: Utf8 { s: "java/io/PrintStream" }
tag(31): Utf8: Utf8 { s: "println" }
tag(32): Utf8: Utf8 { s: "(Ljava/lang/String;)V" }
access_flags: 32
this_class: 9
super_class: 10
interfaces_count: 0
interfaces: []
fields_count: 0
fields: []
methods_count: 2
methods: [MethodInfo { access_flags: 0, name_index: 11, descriptor_index: 12, attributes_count: 1, attributes: [AttributeInfo { attribute_name_index: 13, attribute_length: 29, info: Code { max_stack: 1, max_locals: 1, code_length: 5, code: [42, 183, 0, 1, 177], exception_table_length: 0, exception_table: [], attributes_count: 1, attributes: [AttributeInfo { attribute_name_index: 14, attribute_length: 6, info: LineNumberTable { line_number_table_length: 1, line_number_table: [LineNumber { start_pc: 0, line_number: 1 }] } }] } }] }, MethodInfo { access_flags: 9, name_index: 15, descriptor_index: 16, attributes_count: 1, attributes: [AttributeInfo { attribute_name_index: 13, attribute_length: 53, info: Code { max_stack: 2, max_locals: 5, code_length: 17, code: [20, 0, 2, 64, 20, 0, 4, 74, 178, 0, 6, 18, 7, 182, 0, 8, 177], exception_table_length: 0, exception_table: [], attributes_count: 1, attributes: [AttributeInfo { attribute_name_index: 14, attribute_length: 18, info: LineNumberTable { line_number_table_length: 4, line_number_table: [LineNumber { start_pc: 0, line_number: 3 }, LineNumber { start_pc: 4, line_number: 4 }, LineNumber { start_pc: 8, line_number: 5 }, LineNumber { start_pc: 16, line_number: 6 }] } }] } }] }]
attributes_count: 1
attributes: [AttributeInfo { attribute_name_index: 17, attribute_length: 2, info: SourceFile { sourcefile_index: 18 } }]