Search code examples
javacompilation

Do different JDK Updates produce different Java byte code?


A hypothetical scenario:

I've got a project whose source compliance level is specified to 1.5. Now I compile this project with two different JDKs: At first with JDK 6 Update 7 and then with JDK 6 Update 20.

Do these two different JDKs produce different Java byte code, although they only differ in their Update version?


Solution

  • The generated code usually only differs in case of compiler bug fixes.

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