Re: Compile Date
 
Roedy Green wrote:
Is the compile date of a class embedded in the class file somewhere? I
could see not putting it in to avoid false deltas when the code did
not really change.
     The JVM Specification's description of the class file format doesn't
mention such a thing.  However, a Java (or other) compiler can define
attributes beyond those mentioned in the JVMS, and a timestamp attribute
could be among the extras added.  The JVM ignores attributes other than
the JVMS' set, so (1) such a timestamp wouldn't hurt anything, and (2)
its value would not be visible from inside the JVM after the class was
loaded.
It there a method to find out when a class was most recently compiled?
I suppose it could be handled with a script that generates a little
class containing today's date that gets freshly recompiled each day,
but that really just tells you when the jar was built.
     You could hack javac to emit a "com.mindprod.CompileTime" attribute,
presumably as an attribute of the class itself (attributes also attach
to methods, fields, and so on).  Or you could write a little utility to
add it to an already-compiled .class file -- but that really just tells
you when the utility was run, not when javac ran, so you'd need to be
diligent with your build scripts.
-- 
Eric.Sosman@sun.com