You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/03/01 17:14:20 UTC

groovy git commit: Rename field `cache` to `map` to fix the failing build

Repository: groovy
Updated Branches:
  refs/heads/master 3a3b32c3b -> 7cf557578


Rename field `cache` to `map` to fix the failing build


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

Branch: refs/heads/master
Commit: 7cf55757853a259496275ec884515049641b131c
Parents: 3a3b32c
Author: danielsun1106 <re...@hotmail.com>
Authored: Fri Mar 2 01:14:12 2018 +0800
Committer: danielsun1106 <re...@hotmail.com>
Committed: Fri Mar 2 01:14:12 2018 +0800

----------------------------------------------------------------------
 .../org/codehaus/groovy/runtime/memoize/LRUCache.java | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/7cf55757/src/main/java/org/codehaus/groovy/runtime/memoize/LRUCache.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/memoize/LRUCache.java b/src/main/java/org/codehaus/groovy/runtime/memoize/LRUCache.java
index 7d32561..967641d 100644
--- a/src/main/java/org/codehaus/groovy/runtime/memoize/LRUCache.java
+++ b/src/main/java/org/codehaus/groovy/runtime/memoize/LRUCache.java
@@ -34,23 +34,23 @@ import java.util.concurrent.ConcurrentMap;
  */
 @ThreadSafe
 public final class LRUCache<K, V> implements MemoizeCache<K, V> {
-    private final ConcurrentMap<K, V> cache;
+    private final ConcurrentMap<K, V> map;
 
     public LRUCache(final int maxCacheSize) {
 //        cache = Collections.synchronizedMap(new LRUProtectionStorage(maxCacheSize));
-        cache = new ConcurrentLinkedHashMap.Builder<K, V>()
+        map = new ConcurrentLinkedHashMap.Builder<K, V>()
                 .maximumWeightedCapacity(maxCacheSize)
                 .build();
     }
 
     @Override
     public V put(final K key, final V value) {
-        return cache.put(key, value);
+        return map.put(key, value);
     }
 
     @Override
     public V get(final K key) {
-        return cache.get(key);
+        return map.get(key);
     }
 
     /**
@@ -64,15 +64,15 @@ public final class LRUCache<K, V> implements MemoizeCache<K, V> {
      */
     @Override
     public V getAndPut(K key, ValueProvider<? super K, ? extends V> valueProvider) {
-        return cache.computeIfAbsent(key, k -> valueProvider.provide(k));
+        return map.computeIfAbsent(key, k -> valueProvider.provide(k));
     }
 
     /**
      * Remove all entries holding SoftReferences to gc-evicted objects.
      */
     public void cleanUpNullReferences() {
-        synchronized (cache) {
-            final Iterator<Map.Entry<K, V>> iterator = cache.entrySet().iterator();
+        synchronized (map) {
+            final Iterator<Map.Entry<K, V>> iterator = map.entrySet().iterator();
             while (iterator.hasNext()) {
                 final Map.Entry<K, V> entry = iterator.next();
                 final Object value = entry.getValue();