Java compiled binary changes depending on the order of the source files

I am using the javac compiler and I found that it generates different resulting .class binaries depending on the order of the source files passed as a parameter. In fact, it is a matter of compiling with ANT or MAVEN, because they order the files differently.

There were differences between the two compilations. I parsed the code and I found that javac (optimizer?) Removes deprecated java jsr / ret assembly instructions from one of the compilations.

I'm wondering if this behavior is the result of "implicit" compilation: http://docs.oracle.com/javase/1.5.0/docs/tooldocs/solaris/javac.html#searching

  • Can anyone explain this behavior?

  • How can I generate an "idempotent" compilation process in ANT and MAVEN where the order of the source files passed to the compiler doesn't matter?

+3


source to share


1 answer


You can get a list of your sources and then sort it alphabetically, including the full path. This will make it consistent across runs.



0


source







All Articles