Reviewers: scheglov, scottb,

Description:
This change works around a problem found in GWT Designer testing.

The compilation unit rescue was really only intended for old cached
compilation units, not files that change after you first start running
the process.


Please review this at http://gwt-code-reviews.appspot.com/1446805/

Affected files:
  M dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java


Index: dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java
===================================================================
--- dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java (revision 10183) +++ dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java (working copy)
@@ -394,17 +394,19 @@
           new ResourceCompilationUnitBuilder(typeName, resource);

CompilationUnit cachedUnit = unitCache.find(resource.getPathPrefix() + resource.getPath());
+
+ // Try to rescue cached units from previous sessions where a jar has been
+      // recompiled.
if (cachedUnit != null && cachedUnit.getLastModified() != resource.getLastModified()) {
         unitCache.remove(cachedUnit);
-        if (!cachedUnit.getContentId().equals(builder.getContentId())) {
+        if (cachedUnit instanceof CachedCompilationUnit &&
+            cachedUnit.getContentId().equals(builder.getContentId())) {
+          CachedCompilationUnit updatedUnit =
+ new CachedCompilationUnit((CachedCompilationUnit) cachedUnit, resource
+                  .getLastModified(), resource.getLocation());
+          unitCache.add(updatedUnit);
+        } else {
           cachedUnit = null;
-        } else {
- // Update the cache. The location might have changed since last build
-          // (e.g. jar to file)
-          CachedCompilationUnit updatedUnit =
- new CachedCompilationUnit(cachedUnit.asCachedCompilationUnit(),
-                  resource.getLastModified(), resource.getLocation());
-          unitCache.add(updatedUnit);
         }
       }
       if (cachedUnit != null) {


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to