We are noticing that when we compile our classes on Java 6, they are consistently larger than Java 5.
I understand that there has not been a change to the byte code to date, so I assume the Java 6 compiler is throwing in more stuff. Is that all required, or is there any way to turn that off and still compile Java 6 source code?
The version 6 javac is generating additional "Stack Map" attributes in the class files to make verification by the jvm easier and faster. I doubt this amounts too much size difference, you could alway use the -target 1.5
option to make it generate the same bytecode as earlier in versions.
Edit: Details on this new attribute can be found in section 4.8.4 of jsr 202
4.8.4 The StackMapTable Attribute
The stack map attribute is a variable-length attribute in the attributes table of a Code attribute. The name of the attribute is StackMapTable. This attribute is used during the process of verification by typechecking (§4.11.1).
A stack map attribute consists of zero or more stack map frames. Each stack map frame specifies (either explicitly or implicitly) a bytecode offset, the verification types (§4.11.1) for the local variables, and the verification types for the operand stack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With