Reviewers: tobyr,
Description:
Update to the staleness check when loading the PersistentUnitCache
so that a unit that has changed dependencies (but nothing else) will
be properly loaded.
Please review this at http://gwt-code-reviews.appspot.com/1483803/
Affected files:
M dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java
Index: dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java
===================================================================
--- dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java
(revision 10447)
+++ dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java (working
copy)
@@ -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