Fixes memory leak in ResourceOracleImpl under GWT Designer. While using GWT Designer the class path cache in ResourceOracleImpl never gets cleared of obsolete data. http://gwt-code-reviews.appspot.com/1308801/show Patch by: amitin Review by: me git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9717 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java b/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java index d6dcb5b..9dfdbfa 100644 --- a/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java +++ b/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java
@@ -24,6 +24,9 @@ import com.google.gwt.dev.util.msg.Message0; import com.google.gwt.dev.util.msg.Message1String; +import org.apache.commons.collections.map.AbstractReferenceMap; +import org.apache.commons.collections.map.ReferenceMap; + import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -141,7 +144,9 @@ } } - private static final Map<ClassLoader, List<ClassPathEntry>> classPathCache = new HashMap<ClassLoader, List<ClassPathEntry>>(); + @SuppressWarnings("unchecked") + private static final Map<ClassLoader, List<ClassPathEntry>> classPathCache = new ReferenceMap( + AbstractReferenceMap.WEAK, AbstractReferenceMap.HARD); public static ClassPathEntry createEntryForUrl(TreeLogger logger, URL url) throws URISyntaxException, IOException {