Revision: 10457
Author: [email protected]
Date: Thu Jul 14 12:29:52 2011
Log: Update to the staleness check when loading the PersistentUnitCache
so that a unit that has changed dependencies (but nothing else) will
be properly loaded.
Review at http://gwt-code-reviews.appspot.com/1483803
Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=10457
Modified:
/trunk/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java
Tue Jun 14 05:20:58 2011
+++ /trunk/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java
Thu Jul 14 12:29:52 2011
@@ -500,12 +500,20 @@
}
}
UnitCacheEntry entry = new UnitCacheEntry(unit,
UnitOrigin.PERSISTENT);
- UnitCacheEntry oldEntry =
unitMap.get(unit.getResourcePath());
- if (oldEntry != null && unit.getLastModified() >
oldEntry.getUnit().getLastModified()) {
- super.remove(oldEntry.getUnit());
+ UnitCacheEntry existingEntry =
unitMap.get(unit.getResourcePath());
+ /*
+ * Don't assume that an existing entry is stale - an entry
might
+ * have been loaded already from another source like a
+ * CompilationUnitArchive that is more up to date. If the
+ * timestamps are the same, accept the latest version. If it
turns
+ * out to be stale, it will be recompiled and the updated
unit
+ * will win this test the next time the session starts.
+ */
+ if (existingEntry != null && unit.getLastModified() >=
existingEntry.getUnit().getLastModified()) {
+ super.remove(existingEntry.getUnit());
unitMap.put(unit.getResourcePath(), entry);
unitMapByContentId.put(unit.getContentId(), entry);
- } else if (oldEntry == null) {
+ } else if (existingEntry == null) {
unitMap.put(unit.getResourcePath(), entry);
unitMapByContentId.put(unit.getContentId(), entry);
}
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors