Hi Scott,

The attached patch fixes issue 3611 -- the generated resources are not
updated during a refresh when the -gen argument is used.

Regards,
Amit

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

Index: dev/core/src/com/google/gwt/dev/javac/CompilationState.java
--- dev/core/src/com/google/gwt/dev/javac/CompilationState.java	(revision 5169)
+++ dev/core/src/com/google/gwt/dev/javac/CompilationState.java	(working copy)
@@ -294,7 +294,7 @@ public class CompilationState {
       CompilationUnit graveyardUnit = graveyardUnits.remove(typeName);
       if (graveyardUnit != null) {
         assert graveyardUnit.getState() == State.GRAVEYARD;
-        if (unit.getSource().equals(graveyardUnit.getSource())) {
+        if (unit.getStrongHash().equals(graveyardUnit.getStrongHash())) {
           usefulGraveyardUnits.put(typeName, graveyardUnit);
         } else {
           // The old unit is invalidated.
Index: dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
--- dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java	(revision 5166)
+++ dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java	(working copy)
@@ -378,6 +378,15 @@ public abstract class CompilationUnit {
   public abstract String getSource();
 
   /**
+   * Returns the strong hash of the source. The default implementation simply
+   * returns the source. Subclasses can override this implementation if source
+   * might be overwritten.
+   */
+  public String getStrongHash() {
+    return getSource();
+  }
+
+  /**
    * Returns the fully-qualified name of the top level public type.
    */
   public abstract String getTypeName();
Index: dev/core/src/com/google/gwt/dev/shell/StandardGeneratorContext.java
--- dev/core/src/com/google/gwt/dev/shell/StandardGeneratorContext.java	(revision 5163)
+++ dev/core/src/com/google/gwt/dev/shell/StandardGeneratorContext.java	(working copy)
@@ -148,6 +148,7 @@ public class StandardGeneratorContext implements GeneratorContext {
       implements Generated {
 
     private PrintWriter pw;
+    private String strongHash; // cache so that refreshes work correctly
 
     public GeneratedUnitWithFile(File file, PrintWriter pw, String packageName) {
       super(file, packageName);
@@ -162,6 +163,7 @@ public class StandardGeneratorContext implements GeneratorContext {
     public void commit() {
       pw.close();
       pw = null;
+      strongHash = Util.computeStrongName(getSource().getBytes());
     }
 
     @Override
@@ -171,7 +173,12 @@ public class StandardGeneratorContext implements GeneratorContext {
       }
       return super.getSource();
     }
-
+    
+    @Override 
+    public String getStrongHash() {
+      return strongHash;
+    }
+ 
     @Override
     public boolean isGenerated() {
       return true;

Reply via email to