Create Lambda classfile writer for anonymous classes
Closed this issue · 4 comments
Zelldon commented
Example:
$ javap -c -v LambdaBytecode\$1.class Classfile /Users/christopher/Documents/cb-projekt/SWPSoSe14/projekt-compiler/JavaByteCode/build/classes/LambdaBytecode$1.class Last modified Jul 7, 2014; size 696 bytes MD5 checksum 188a50e2fd8fa0b1d6f187d889a953c0 Compiled from "LambdaBytecode.java" final class LambdaBytecode$1 implements Lambda SourceFile: "LambdaBytecode.java" EnclosingMethod: #23.#24 // LambdaBytecode.main InnerClasses: static #5; //class LambdaBytecode$1 minor version: 0 major version: 51 flags: ACC_FINAL, ACC_SUPER Constant pool: #1 = Methodref #6.#25 // java/lang/Object."":()V #2 = Fieldref #26.#27 // java/lang/System.out:Ljava/io/PrintStream; #3 = String #28 // Hello #4 = Methodref #29.#30 // java/io/PrintStream.print:(Ljava/lang/String;)V #5 = Class #31 // LambdaBytecode$1 #6 = Class #32 // java/lang/Object #7 = Class #33 // Lambda #8 = Utf8 #9 = Utf8 ()V #10 = Utf8 Code #11 = Utf8 LineNumberTable #12 = Utf8 LocalVariableTable #13 = Utf8 this #14 = Utf8 #15 = Utf8 InnerClasses #16 = Utf8 LLambdaBytecode$1; #17 = Utf8 closure #18 = Utf8 org.netbeans.SourceLevelAnnotations #19 = Utf8 Ljava/lang/Override; #20 = Utf8 SourceFile #21 = Utf8 LambdaBytecode.java #22 = Utf8 EnclosingMethod #23 = Class #34 // LambdaBytecode #24 = NameAndType #35:#36 // main:([Ljava/lang/String;)V #25 = NameAndType #8:#9 // "":()V #26 = Class #37 // java/lang/System #27 = NameAndType #38:#39 // out:Ljava/io/PrintStream; #28 = Utf8 Hello #29 = Class #40 // java/io/PrintStream #30 = NameAndType #41:#42 // print:(Ljava/lang/String;)V #31 = Utf8 LambdaBytecode$1 #32 = Utf8 java/lang/Object #33 = Utf8 Lambda #34 = Utf8 LambdaBytecode #35 = Utf8 main #36 = Utf8 ([Ljava/lang/String;)V #37 = Utf8 java/lang/System #38 = Utf8 out #39 = Utf8 Ljava/io/PrintStream; #40 = Utf8 java/io/PrintStream #41 = Utf8 print #42 = Utf8 (Ljava/lang/String;)V { LambdaBytecode$1(); flags: Code: stack=1, locals=1, args_size=1 0: aload_0 1: invokespecial #1 // Method java/lang/Object."":()V 4: return LineNumberTable: line 35: 0 LocalVariableTable: Start Length Slot Name Signature 0 5 0 this LLambdaBytecode$1; public void closure(); flags: ACC_PUBLIC Code: stack=2, locals=1, args_size=1 0: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream; 3: ldc #3 // String Hello 5: invokevirtual #4 // Method java/io/PrintStream.print:(Ljava/lang/String;)V 8: return LineNumberTable: line 40: 0 line 41: 8 LocalVariableTable: Start Length Slot Name Signature 0 9 0 this LLambdaBytecode$1; org.netbeans.SourceLevelAnnotations: length = 0x6 00 01 00 13 00 00 }
Zelldon commented
cafe babe 0000 0033 002b #count constantpool 0a 0006 0019 //method 09 001a 001b //field 08 001c //string 0a 001d 001e 07 001f 07 0020 07 0021 // 01 0006 3c69 6e69 743e 01 0003 2829 56 01 0004 436f 6465 01 000f 4c69 6e65 4e75 6d62 6572 5461 626c 65 01 0012 4c6f 6361 6c56 6172 6961 626c 6554 6162 6c65 01 0004 7468 6973 01 0000 01 000c 496e 6e65 7243 6c 6173 7365 73 01 0012 4c4c 616d 6264 6142 7974 6563 6f64 6524 313b 01 0007 636c 6f73 7572 65 01 0023 6f 7267 2e6e 6574 6265 616e 732e 536f 7572 6365 4c65 7665 6c41 6e6e 6f74 6174 696f 6e73 01 0014 4c 6a61 7661 2f6c 616e 672f 4f76 6572 7269 6465 3b 01 000a 536f 7572 6365 4669 6c65 01 0013 4c 616d 6264 6142 7974 6563 6f64 652e 6a61 7661 01 000f 45 6e63 6c6f 7369 6e67 4d65 7468 6f64 07 0022 0c 0023 0024 0c 0008 0009 07 0025 0c 0026 0027 01 0005 4865 6c6c 6f 07 0028 0c 0029 002a 01 0010 4c61 6d62 6461 4279 7465 636f 6465 2431 01 0010 6a 6176 612f 6c61 6e67 2f4f 626a 6563 74 01 0006 4c61 6d62 6461 01 000e 4c 616d 6264 6142 7974 6563 6f64 65 01 0004 6d61 696e 01 0016 28 5b4c 6a61 7661 2f6c 616e 672f 5374 7269 6e67 3b29 56 01 0010 6a61 7661 2f6c 616e 672f 5379 7374 656d 0100 036f 7574 01 0015 4c 6a61 7661 2f69 6f2f 5072 696e 7453 7472 6561 6d3b 01 0013 6a 6176 612f 696f 2f50 7269 6e74 5374 7265 616d 01 0005 70 7269 6e74 01 0015 28 4c6a 6176 612f 6c61 6e67 2f53 7472 696e 673b 2956 0030 //final super 0005 0006 0001 //interface count 1 0007 //lambda class idx in constantpool 0000 //field count 0 0002 // method count 0000 0008 // 0009 //()V 0001 //attr count 1 000a //Code 0000 002f //attr length 0001 //max stack 0001 // max locals 0000 0005 //code length 2a b7 00 01 b1 // code 0000 //exception table len 0002 //attr count 2 000b // line number table 0000 0006 //attr len 0001 //line nr len 0000 0023 //start pc and line nr 000c //local variable table 0000 000c //attr len 12 0001 //local variable table len 0000 0005 000d //this 0010 // LLambdaBytecode$1; 0000 //idx 0001 //public 0011 //closure 0009 // ()V 0002 //attr count 2 000a // code 0000 0037 0002 0001 0000 0009 b200 0212 03b6 0004 b1 0000 0002 //attr count 000b //line nr table 0000 000a 0002 0000 0028 0008 0029 000c //local var table 0000 000c 0001 0000 0009 000d 0010 0000 0012 //org.netbeans.SourceLevelAnnotations 0000 0006 0001 0013 0000 0003 0014 //sourcefile attr 0000 0002 0015 //LambdaBytecode.java 0016 //EnclosingMethod 0000 0004 0017 //LambdaBytecode class idx 0018 //main:([Ljava/lang/String;)V (name and type idx) 000f //InnerClasses 0000 000a //attr len 0001 //nr of classes 0005 // LambdaBytecode$1 class idx 0000 //outer class info idx - zero if anonymous class 0000 //inner name idx - zero if anonymous class 0008 //access flags STATIC
Zelldon commented
WOHOOOO successful created first VALID lambda anonymous class file
Zelldon commented
yes baby done