This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 5e0cef8b89d4ebc5c4f0f2e3cdc394e555225cfa Author: Daniel Sun <[email protected]> AuthorDate: Fri May 10 21:52:42 2019 +0800 GROOVY-9112: Clean bad smell in `GroovyClassLoader`(closes #926) --- src/main/groovy/groovy/lang/GroovyClassLoader.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/groovy/groovy/lang/GroovyClassLoader.java b/src/main/groovy/groovy/lang/GroovyClassLoader.java index b270978..ac3b75f 100644 --- a/src/main/groovy/groovy/lang/GroovyClassLoader.java +++ b/src/main/groovy/groovy/lang/GroovyClassLoader.java @@ -93,13 +93,13 @@ public class GroovyClassLoader extends URLClassLoader { /** * this cache contains the loaded classes or PARSING, if the class is currently parsed */ - protected final Map<String, Class> classCache = new UnlimitedConcurrentCache<String, Class>(); + protected final EvictableCache<String, Class> classCache = new UnlimitedConcurrentCache<String, Class>(); /** * This cache contains mappings of file name to class. It is used * to bypass compilation. */ - protected final Map<String, Class> sourceCache = new StampedCommonCache<String, Class>(); + protected final StampedCommonCache<String, Class> sourceCache = new StampedCommonCache<String, Class>(); private final CompilerConfiguration config; private String sourceEncoding; @@ -322,7 +322,7 @@ public class GroovyClassLoader extends URLClassLoader { // and avoid occupying Permanent Area/Metaspace repeatedly String cacheKey = genSourceCacheKey(codeSource); - return ((StampedCommonCache<String, Class>) sourceCache).getAndPut( + return sourceCache.getAndPut( cacheKey, new EvictableCache.ValueProvider<String, Class>() { @Override @@ -1157,7 +1157,7 @@ public class GroovyClassLoader extends URLClassLoader { * @see #removeClassCacheEntry(String) */ public void clearCache() { - Map<String, Class> clearedClasses = ((EvictableCache<String, Class>)classCache).clearAll(); + Map<String, Class> clearedClasses = classCache.clearAll(); sourceCache.clear();
