Revision: 8828
Author: [email protected]
Date: Tue Sep 21 04:21:01 2010
Log: Fix GWTShell. Compare classpaths by content instead of reference in ResourceOracleImpl.refresh(). Note that this is still much faster than the old behavior of exploring each classpath individually.

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

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

Modified:
 /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ClassPathEntry.java
/trunk/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ClassPathEntry.java Fri Sep 17 13:02:11 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ClassPathEntry.java Tue Sep 21 04:21:01 2010
@@ -27,18 +27,18 @@
  */
 public abstract class ClassPathEntry {

-  /**
- * Finds every resource at abstract path P within this classpath such that P - * begins with a prefix X from the path prefix set and P is allowed by the
-   * filter associated with X.
-   *
- * @return a map with key as an allowed resource and value as the PathPrefix - * that allows the resource; note no guarantees are made regarding the - * identities of the returned resource objects, and the same object
-   *         may be returned across multiple calls
-   */
- public abstract Map<AbstractResource, PathPrefix> findApplicableResources(
-      TreeLogger logger, PathPrefixSet pathPrefixSet);
+  @Override
+  public final boolean equals(Object other) {
+    if (other instanceof ClassPathEntry) {
+      ClassPathEntry otherCpe = (ClassPathEntry) other;
+      boolean ret = getLocation().equals(otherCpe.getLocation());
+      // The concrete class should not differ if the location is equal
+      assert (ret ? getClass() == otherCpe.getClass() : true);
+      return ret;
+    } else {
+      return false;
+    }
+  }

   /**
    * Finds applicable resources for a list of pathPrefixSets, returning a
@@ -55,12 +55,32 @@
     }
     return results;
   }
+
+  /**
+ * Finds every resource at abstract path P within this classpath such that P + * begins with a prefix X from the path prefix set and P is allowed by the
+   * filter associated with X.
+   *
+ * @return a map with key as an allowed resource and value as the PathPrefix + * that allows the resource; note no guarantees are made regarding the + * identities of the returned resource objects, and the same object
+   *         may be returned across multiple calls
+   */
+ public abstract Map<AbstractResource, PathPrefix> findApplicableResources(
+      TreeLogger logger, PathPrefixSet pathPrefixSet);

   /**
    * Gets a URL string that describes this class path entry.
+   *
+   * ClassPathEntries with the same location string are considered equal.
    */
   public abstract String getLocation();
-
+
+  @Override
+  public final int hashCode() {
+    return getLocation().hashCode();
+  }
+
   @Override
   public String toString() {
     return getClass().getSimpleName() + ": " + getLocation();
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java Fri Sep 17 13:02:11 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java Tue Sep 21 04:21:01 2010
@@ -200,8 +200,9 @@

     List<PathPrefixSet> pathPrefixSets = new ArrayList<PathPrefixSet>();
     for (ResourceOracleImpl oracle : oracles) {
-      if (oracle.classPath != oracles[0].classPath) {
-        throw new IllegalArgumentException();
+      if (!oracle.classPath.equals(oracles[0].classPath)) {
+        throw new IllegalArgumentException(
+            "Refreshing multiple oracles with different classpaths");
       }
       resourceDataMaps.add(new LinkedHashMap<String, ResourceData>());
       pathPrefixSets.add(oracle.pathPrefixSet);

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

Reply via email to