Should I always compile Java code with latest javac compiler?

后端 未结 2 1099
眼角桃花
眼角桃花 2021-01-27 00:00

I\'m about to upgrade a tomcat installation from version 6.0 to version 8.5, and also upgrading the JVM from 6 to 8. Our java code is compiled with java 6 as for now.

I

2条回答
  •  不知归路
    2021-01-27 00:39

    As you already know, there is no real requirement for compiling Java code with the latest versions of the language. It is up to you.

    Common points to consider:

    • Compatibility issues with dependency libraries and frameworks
    • Compatibility issues/unsupported binary versions on the target JVM versions
    • Known performance (or other improvements) in the newer Java versions.
    • Backward compatibility - code compiled with newer Java (e.g. 8) might not always be able to execute on older JVM (e.g. 6).

    I would (and I encourage you) to check the release notes to see what changes, improvements, compatibility constraints etc. are introduced in the new JVM version.

提交回复
热议问题