I changed a couple of classes in my Grails project and built a war file. I then compared the .class files from the new war to the ones in the war which was built before my changes (on a different machine, if that matters) and it turns out that many (if not all) .class files are different. Looking at the decompiled classes it seems that the differences are because of a timestamp in a variable such as this:
public static long __timeStamp__239_neverHappen1360886953029;
Does anyone know what this variable is?
Typically, you declare a class's variables before you declare its methods, although this is not required. Note: To declare variables that are a member of a class, the declarations must be within the class body, but not within the body of a method. Variables declared within the body of a method are local to that method.
Static variables should be used to track data that are shared in common by all of the instances of a class. These variables are also called class variables. Class variables are distinguished from instance variables. Instance variables track the data that belong to each individual object of a class.
A Java variable is a compile-time constant if it's of a primitive type or String, declared final, initialized within its declaration, and with a constant expression. Strings are a special case on top of the primitive types because they are immutable and live in a String pool.
Class variables also known as static variables are declared with the static keyword in a class, but outside a method, constructor or a block. There would only be one copy of each class variable per class, regardless of how many objects are created from it.
It comes from groovy class generation.
See some discussion here http://groovy.329449.n5.nabble.com/Timestamp-in-class-files-leads-to-huge-patches-td365696.html
For the sake of completeness , quoted here:-
For Groovy's own recompilation mechanism. Sources are not always in file form, so we can't "just" check the file timestamp, so we had to store that timestamp somewhere... and where better than in the class itself since that's all we have?
On Tue, Mar 3, 2009 at 10:39, Jason Dillon <[hidden email]> wrote:
Why does groovyc capture the compile timestamp? What good is that for?
This changed in Groovy 2.4, the .class files no longer contain a timestamp field.
https://github.com/groovy/groovy-core/commit/bcdb89e
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With