Why is the class size compiled by Java 6 larger than that of Java 5?

We notice that when we compile our classes on Java 6, they are always larger than Java 5

I understand that bytecode has not changed so far, so I think the Java 6 compiler is investing more Is this necessary, or is there any way to turn it off and still compile Java 6 source code?

Solution

Version 6 javac is generating additional "stack map" attributes in class files to make JVM verification easier and faster I suspect this number is too large. You can generate the same bytecode as the previous version by using the - target 1.5 option

Edit: for more information about this new attribute, see 4.8.1 of JSR 202 Section 4

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>