UiBinderGenerator is not stable and results extra compiles during web app
reload.  In order to avoid unnecessary compiles and type oracle refreshes, code
generators must be stable.
    
This patch is a partial fix in that visitation orders have been stabilized,
however the issue of generated, unique DOM element identifiers still exists and
will prevent UiBinder from being completely stable.
    
Please see issue
http://code.google.com/p/google-web-toolkit/issues/detail?id=4067 for more
details.
    
Review by: rjrjr



git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6193 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/uibinder/rebind/AbstractFieldWriter.java b/user/src/com/google/gwt/uibinder/rebind/AbstractFieldWriter.java
index 291368f..24052c5 100644
--- a/user/src/com/google/gwt/uibinder/rebind/AbstractFieldWriter.java
+++ b/user/src/com/google/gwt/uibinder/rebind/AbstractFieldWriter.java
@@ -19,7 +19,7 @@
 import com.google.gwt.core.ext.typeinfo.JClassType;
 import com.google.gwt.core.ext.typeinfo.JType;
 
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Set;
 
 /**
@@ -33,7 +33,7 @@
     + " @UiConstructor.";
 
   private final String name;
-  private final Set<FieldWriter> needs = new HashSet<FieldWriter>();
+  private final Set<FieldWriter> needs = new LinkedHashSet<FieldWriter>();
   private String initializer;
   private boolean written;
   private MortalLogger logger;
diff --git a/user/src/com/google/gwt/uibinder/rebind/model/OwnerClass.java b/user/src/com/google/gwt/uibinder/rebind/model/OwnerClass.java
index c7ee4f0..ac982f7 100644
--- a/user/src/com/google/gwt/uibinder/rebind/model/OwnerClass.java
+++ b/user/src/com/google/gwt/uibinder/rebind/model/OwnerClass.java
@@ -26,9 +26,12 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 
 /**
  * Model class with all attributes of the owner class.
@@ -40,7 +43,7 @@
    * Map from field name to model.
    */
   private final Map<String, OwnerField> uiFields =
-      new HashMap<String, OwnerField>();
+      new TreeMap<String, OwnerField>();
 
   /**
    * Map from field type to model.