Compiler construction – will different JDK updates produce different Java bytecodes?

Scenario:

I have a project whose source compliance level is specified as 1.5 Now I compile this project with two different jdks: first JDK 6 update 7, and then JDK 6 update 20

These two different jdks produce different Java bytecode, although they are different in the update version?

Solution

The generated code usually differs only in the case of compiler error fixes

However, JLS does not specify a 1:1 mapping from the source code to the generated bytecode, so you should not rely on the exact bytecode to be generated

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
分享
二维码
< <上一篇
下一篇>>