Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Assuming that the JDK versions, build tool versions, and build / compilation options are identical, I can still think of 5 <em>possible</em> sources of differences:</p> <ol> <li><p>Timestamps - class files may<sup>1</sup> contain compilation timestamps. Unless you run the compilations at exactly the same times, different compilations of the same file would result different timestamps.</p></li> <li><p>Source filename paths - each class file includes the pathname of the source file. If you compile two trees with different pathnames the class files will contain different source pathnames.</p></li> <li><p>Values of imported compile-time constants - when a class <code>A</code> uses a compile-time constant defined in another class <code>B</code> (see JLS for the definition of a "compile time constant"), the value of the constant is incorporated into <code>A</code>s class file. So if you compile <code>A</code> against different versions of <code>B</code> (with different values for the constants), the code of <code>A</code> is likely to be different.</p></li> <li><p>Differences in signatures of external classes / methods; e.g. if you changed a dependency version in one of your POM files.</p></li> <li><p>Differences in the build classpaths might result in differences in the order in which imported classes are found which might result in non-significant differences in the order of entries in the class file's Constant Pool. This could happen due to things such as:</p> <ul> <li>files appearing in different order in the directories of external JAR files,</li> <li>files being compiled in different order due to the source files being in different order when your build tool iterates them, or</li> <li>parallelism in the build (if you have that enabled).</li> </ul></li> </ol> <p>Note that you don't normally see the actual order of files in FS directories, because tools like <code>ls</code> and <code>dir</code> default to sorting the entries before displaying them.</p> <p><sup>1 - This is compiler dependent. Also, it is not guaranteed that <code>javap</code> will show the timestamps ... if they are present.</sup></p> <hr> <p>I should add that the first step to identifying the cause of the differences is to work out exactly what they are. You probably need (needed) to do that the hard way - by manually decoding a pair of class files to identify the places where they actually differences ... and what the differences actually mean.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload