When compiling java with different versions of JDK, the same target and source versions are guaranteed to perform the same operation?

We will update our CI system from Java 7 creation to Java 8 After that, we want to migrate the projects to Java 8.0 one by one Of course, we want to be able to create bug fixes for older versions that still use Java 7

If we transfer the same source code, target version and source code from JDK 7 to JDK 8, can we be sure that there will be no problems? We tested on the development machine without any problems

Before that, we also gradually updated the deployment server from JRE 7 to JRE 8

Please note that we want to keep a single Java JDK installation on the CI system, otherwise it will become complex

To make it clearer, I am more interested in the same execution result than the same bytecode The same bytecode will only confirm the first one (running on the same JRE), if I understand

We will not use Java 8 functionality in our code until we run all deployments on Java 8 So compatibility is not a problem

Solution

There is no guarantee

In fact, two are created on the same hardware with the same options using the same compiler Class files will have the same bytecode, but they may still be different due to the embedded compilation timestamp attribute

However, if you want to compare nominally equivalent bytecode files, this Q & A provides some possible clues:

> Is there a tool that we could use to compare two Jars at Binary/Byte code level?

I hope you will find some differences between the bytecodes generated by the Java 7 and Java 8 compilers, but this is not important

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