开发者

Managing Java version compatibility

开发者 https://www.devze.com 2023-02-14 22:04 出处:网络
I have read that \"JDKs are usually forward-compatible, and JREs are usually backward-compatible.\" What kind of version ch开发者_StackOverflowecking do Java developers do in their applications?

I have read that "JDKs are usually forward-compatible, and JREs are usually backward-compatible."

What kind of version ch开发者_StackOverflowecking do Java developers do in their applications?

Do you upgrade your JDK with every release?

How do you minimize incompatibilities between releases?


How do you minimize incompatibilities between releases?

  • Reading documents like Incompatibilities in J2SE 5.0 since 1.4.2
  • Using this table to find out all incompatibilities between jdk versions:

Managing Java version compatibility

The report is generated by the japi-compliance-checker tool.


The strategy that's worked well for us is to decide up front which versions of the JRE we'll support. We do this by considering the platforms in use by our users, the version-specific features of a particular JRE that we'd like to use, and the release dates of the JRE versions. All of this is done in close consultation with our customer support department. (Of course all else being equal we prefer newer releases, as they tend to have bug fixes, optimizations, security updates, etc.)

Then, this becomes input into our QA process. Our testing effort must encompass all of the versions of the JRE that we're supporting.

Finally, we use the ability to specify specific JRE versions in the JNLP file when we deploy our application, to ensure that customers who try to run our app with an unsupported version get a "fail-fast" experience (with a helpful message about how to get the right JRE version), rather than mysterious failures down the road.

One thing we do to minimize incompatibilities is to avoid undocumented APIs (sun.misc, etc.).

Explicitly checking the current version of the JRE from within your code should be considered only as last resort to work around a known bug in a particular JRE version. If such a bug is discovered early enough in the process, we much prefer to just remove that JRE version from the list of supported versions.

0

精彩评论

暂无评论...
验证码 换一张
取 消