Revision: 10186
Author:   [email protected]
Date:     Sat May 14 03:39:11 2011
Log:      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.

Review at http://gwt-code-reviews.appspot.com/1446805

http://code.google.com/p/google-web-toolkit/source/detail?r=10186

Modified:
 /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java Thu May 12 10:40:46 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java Sat May 14 03:39:11 2011
@@ -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())) {
-          cachedUnit = null;
-        } else {
- // Update the cache. The location might have changed since last build
-          // (e.g. jar to file)
+        if (cachedUnit instanceof CachedCompilationUnit &&
+            cachedUnit.getContentId().equals(builder.getContentId())) {
           CachedCompilationUnit updatedUnit =
- new CachedCompilationUnit(cachedUnit.asCachedCompilationUnit(),
-                  resource.getLastModified(), resource.getLocation());
+ new CachedCompilationUnit((CachedCompilationUnit) cachedUnit, resource
+                  .getLastModified(), resource.getLocation());
           unitCache.add(updatedUnit);
+        } else {
+          cachedUnit = null;
         }
       }
       if (cachedUnit != null) {

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

Reply via email to