Reviewers: scottb, kplatfoot,
Description:
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.
Please review this at http://gwt-code-reviews.appspot.com/904801/show
Affected files:
M dev/core/src/com/google/gwt/dev/resource/impl/ClassPathEntry.java
M dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java
Index: dev/core/src/com/google/gwt/dev/resource/impl/ClassPathEntry.java
===================================================================
--- dev/core/src/com/google/gwt/dev/resource/impl/ClassPathEntry.java
(revision 8821)
+++ dev/core/src/com/google/gwt/dev/resource/impl/ClassPathEntry.java
(working copy)
@@ -27,18 +27,16 @@
*/
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 boolean equals(Object other) {
+ if (other instanceof ClassPathEntry) {
+ ClassPathEntry otherCpe = (ClassPathEntry) other;
+ return getClass().equals(otherCpe.getClass())
+ && getLocation().equals(otherCpe.getLocation());
+ } else {
+ return false;
+ }
+ }
/**
* Finds applicable resources for a list of pathPrefixSets, returning a
@@ -57,10 +55,28 @@
}
/**
+ * 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.
*/
public abstract String getLocation();
-
+
+ @Override
+ public int hashCode() {
+ return getClass().hashCode() + 29 * getLocation().hashCode();
+ }
+
@Override
public String toString() {
return getClass().getSimpleName() + ": " + getLocation();
Index: dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java
===================================================================
--- dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java
(revision 8821)
+++ dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java
(working copy)
@@ -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