Reviewers: jbrosenberg, tobyr,

Description:
CachedCompilationUnits were inadvertently writing
two compies when serialized, because CompiledClass
contained a reference to the previous compilation
unit used to create the CCU.


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

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


Index: dev/core/src/com/google/gwt/dev/javac/CachedCompilationUnit.java
===================================================================
--- dev/core/src/com/google/gwt/dev/javac/CachedCompilationUnit.java (revision 10516) +++ dev/core/src/com/google/gwt/dev/javac/CachedCompilationUnit.java (working copy)
@@ -54,6 +54,10 @@
       String resourceLocation) {
     assert unit != null;
     this.compiledClasses = unit.getCompiledClasses();
+    // CompiledClass contains a backref to CompilationUnit - repoint it.
+    for (CompiledClass cc : compiledClasses) {
+      cc.initUnit(this);
+    }
     this.contentId = unit.getContentId();
     this.dependencies = unit.getDependencies();
     this.resourcePath = unit.getResourcePath();
@@ -86,6 +90,10 @@
   CachedCompilationUnit(CompilationUnit unit, long astToken) {
     assert unit != null;
     this.compiledClasses = unit.getCompiledClasses();
+    // CompiledClass contains a backref to CompilationUnit - repoint it.
+    for (CompiledClass cc : compiledClasses) {
+      cc.initUnit(this);
+    }
     this.contentId = unit.getContentId();
     this.dependencies = unit.getDependencies();
     this.resourceLocation = unit.getResourceLocation();


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

Reply via email to