Removes the assertion from FileResource.
FileResource is asserting is argument isFile. This is a
poor assertion because when the resource is deleted, the
result is false (hence you can have a FileResource with
isFile returns false if FileResource is deleted afterwards).
Enforcing this assertion also makes it difficult to use
FileResource as a key in a map and complicates interning
(this wasn't a problem earlier because deleted resource
was already interned, so FileResource instance was returned
from map).
Also fixes the test logic for detecting origin of resources.
(This patch will fix the broken build.)
Change-Id: I437f3bff581b52d0675d175b7d8be126cdf3e659
Review-Link: https://gwt-review.googlesource.com/#/c/10911/
diff --git a/dev/core/src/com/google/gwt/dev/resource/impl/FileResource.java b/dev/core/src/com/google/gwt/dev/resource/impl/FileResource.java
index 46174e3..4333e79 100644
--- a/dev/core/src/com/google/gwt/dev/resource/impl/FileResource.java
+++ b/dev/core/src/com/google/gwt/dev/resource/impl/FileResource.java
@@ -47,7 +47,6 @@
private final File file;
private FileResource(String abstractPathName, File file) {
- assert (file.isFile()) : file + " is not a file.";
this.abstractPathName = abstractPathName;
this.file = file;
}
diff --git a/dev/core/test/com/google/gwt/dev/resource/impl/ResourceOracleImplTest.java b/dev/core/test/com/google/gwt/dev/resource/impl/ResourceOracleImplTest.java
index d7d4e87..1bbbff9 100644
--- a/dev/core/test/com/google/gwt/dev/resource/impl/ResourceOracleImplTest.java
+++ b/dev/core/test/com/google/gwt/dev/resource/impl/ResourceOracleImplTest.java
@@ -102,10 +102,11 @@
public void assertPathIncluded(String expectedPath, ClassPathEntry expectedCpe) {
AbstractResource resource = findResourceWithPath(expectedPath);
assertNotNull(resource);
- if (expectedCpe.getLocation().endsWith(".jar")) {
- assertTrue(resource.getLocation().startsWith("jar:" + expectedCpe.getLocation()));
+ String cpeLocation = expectedCpe.getLocation();
+ if (cpeLocation.endsWith(".jar") || cpeLocation.endsWith(".zip")) {
+ assertTrue(resource.getLocation().startsWith("jar:" + cpeLocation));
} else {
- assertTrue(resource.getLocation().startsWith(expectedCpe.getLocation()));
+ assertTrue(resource.getLocation().startsWith(cpeLocation));
}
}