groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [4/4] groovy git commit: Trivial refactoring
Date Mon, 11 Dec 2017 15:52:47 GMT
Trivial refactoring

(cherry picked from commit 0d1890c)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/aa65f867
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/aa65f867
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/aa65f867

Branch: refs/heads/GROOVY_2_5_X
Commit: aa65f86775f567418f1e537f02b74ccd7a8c8a49
Parents: 01bc293
Author: sunlan <sunlan@apache.org>
Authored: Mon Dec 11 23:48:39 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Mon Dec 11 23:52:35 2017 +0800

----------------------------------------------------------------------
 src/main/groovy/lang/GroovyClassLoader.java                      | 4 ++--
 .../codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | 2 +-
 .../src/main/java/groovy/json/internal/SimpleCache.java          | 3 ++-
 .../org/codehaus/groovy/macro/transform/MacroMethodsCache.java   | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/aa65f867/src/main/groovy/lang/GroovyClassLoader.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/GroovyClassLoader.java b/src/main/groovy/lang/GroovyClassLoader.java
index a491fc0..37480cb 100644
--- a/src/main/groovy/lang/GroovyClassLoader.java
+++ b/src/main/groovy/lang/GroovyClassLoader.java
@@ -43,8 +43,8 @@ import org.codehaus.groovy.control.Phases;
 import org.codehaus.groovy.control.SourceUnit;
 import org.codehaus.groovy.runtime.IOGroovyMethods;
 import org.codehaus.groovy.runtime.InvokerHelper;
-import org.codehaus.groovy.runtime.memoize.EvictableCache;
 import org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache;
+import org.codehaus.groovy.runtime.memoize.EvictableCache;
 import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.ClassWriter;
 import org.objectweb.asm.Opcodes;
@@ -95,7 +95,7 @@ public class GroovyClassLoader extends URLClassLoader {
     /**
      * this cache contains the loaded classes or PARSING, if the class is currently parsed
      */
-    protected final ConcurrentCommonCache<String, Class> classCache = new ConcurrentCommonCache<String,
Class>();
+    protected final EvictableCache<String, Class> classCache = new ConcurrentCommonCache<String,
Class>();
 
     /**
      * This cache contains mappings of file name to class. It is used

http://git-wip-us.apache.org/repos/asf/groovy/blob/aa65f867/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
index 32c464d..80bc91f 100644
--- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
+++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
@@ -2043,7 +2043,7 @@ public abstract class StaticTypeCheckingSupport {
      * a method lookup.
      */
     private static class ExtensionMethodCache {
-        private final ConcurrentCommonCache<ClassLoader, Map<String, List<MethodNode>>>
cache = new ConcurrentCommonCache<ClassLoader, Map<String, List<MethodNode>>>(new
WeakHashMap<ClassLoader, Map<String, List<MethodNode>>>());
+        private final EvictableCache<ClassLoader, Map<String, List<MethodNode>>>
cache = new ConcurrentCommonCache<ClassLoader, Map<String, List<MethodNode>>>(new
WeakHashMap<ClassLoader, Map<String, List<MethodNode>>>());
 
         public Map<String, List<MethodNode>> getExtensionMethods(ClassLoader
loader) {
             return cache.getAndPut(

http://git-wip-us.apache.org/repos/asf/groovy/blob/aa65f867/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java
index d3d97d2..45153d5 100644
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java
+++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java
@@ -19,12 +19,13 @@
 package groovy.json.internal;
 
 import org.codehaus.groovy.runtime.memoize.CommonCache;
+import org.codehaus.groovy.runtime.memoize.EvictableCache;
 
 /**
  * @author Richard Hightower
  */
 public class SimpleCache<K, V> implements Cache<K, V> {
-    private CommonCache<K, V> cache;
+    private EvictableCache<K, V> cache;
 
     public SimpleCache(final int limit, CacheType type) {
         if (type.equals(CacheType.LRU)) {

http://git-wip-us.apache.org/repos/asf/groovy/blob/aa65f867/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroMethodsCache.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroMethodsCache.java
b/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroMethodsCache.java
index 13cf2b2..0072c1e 100644
--- a/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroMethodsCache.java
+++ b/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroMethodsCache.java
@@ -44,7 +44,7 @@ import java.util.WeakHashMap;
  */
 class MacroMethodsCache {
     private static final ClassNode MACRO_ANNOTATION_CLASS_NODE = ClassHelper.make(Macro.class);
-    private static final ConcurrentCommonCache<ClassLoader, Map<String, List<MethodNode>>>
CACHE = new ConcurrentCommonCache<ClassLoader, Map<String, List<MethodNode>>>(new
WeakHashMap<ClassLoader, Map<String, List<MethodNode>>>());
+    private static final EvictableCache<ClassLoader, Map<String, List<MethodNode>>>
CACHE = new ConcurrentCommonCache<ClassLoader, Map<String, List<MethodNode>>>(new
WeakHashMap<ClassLoader, Map<String, List<MethodNode>>>());
 
     public static Map<String, List<MethodNode>> get(final ClassLoader classLoader)
{
         return CACHE.getAndPut(classLoader, new EvictableCache.ValueProvider<ClassLoader,
Map<String, List<MethodNode>>>() {


Mime
View raw message