<div dir="ltr">Interesting. In my opinion timestamps inside a JAR is meaningless.<div><div>And the fact that you reset them all the time seems to support that.</div><div><br></div><div>What do you think about the related problem here?</div>
<div><a href="https://bugs.openjdk.java.net/browse/JDK-8028196">https://bugs.openjdk.java.net/browse/JDK-8028196</a></div><div><br></div><div>//Fredrik<br><div><br></div></div></div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">2013/11/13 Jeremy Manson <span dir="ltr"><<a href="mailto:jeremymanson@google.com" target="_blank">jeremymanson@google.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi folks,<div><br></div><div>A bit of background:</div><div><br></div><div>- We use a content-addressable storage around here, so to minimize the diffs between two JAR files (and get more hits in our content-addressable storage), we reset all timestamps in JAR files to the same values.</div>
<div>- Some of our users include both source and class files in their JAR files.</div><div>- When those users want to put those JAR files on the classpath for javac, and use them to compile other files, they may not have included enough on the classpath to compile the source files.</div>
<div>- We've worked around this by favoring classfiles when the two files are of the same age. This has the added benefit of not having to recompile the source files when they are found.</div><div>- What do you think? Too esoteric? Wait for JDK9?</div>
<div><br></div><div>Jeremy</div><div><br></div><div><div>diff --git a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java</div><div>--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java</div>
<div>+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java</div><div>@@ -2690,7 +2690,11 @@</div><div> long bdate = b.getLastModified();</div><div> // 6449326: policy for bad lastModifiedTime in ClassReader</div>
<div> //assert adate >= 0 && bdate >= 0;</div><div>- return (adate > bdate) ? a : b;</div><div>+ return (adate > bdate) ? a :</div><div>+ (bdate > adate) ? b :</div>
<div>+ // These dates can be equal if the files' timestamps were reset.</div><div>+ // In this case, prefer the .class file.</div><div>+ (a.getKind() == JavaFileObject.Kind.CLASS) ? a : b;</div>
<div> }</div><div> }</div></div><div><br></div></div>
</blockquote></div><br></div>