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 8543712d62e8de6f438d4bd4e73afb1cb4702019 Author: Daniel Sun <sun...@apache.org> AuthorDate: Sat May 16 19:50:27 2020 +0800 Trivial refactoring: remove unnecessary qualifier --- .../ConcurrentLinkedHashMap.java | 26 ++++++------ .../concurrentlinkedhashmap/Weighers.java | 46 +++++++++++----------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/main/java/org/apache/groovy/util/concurrent/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java b/src/main/java/org/apache/groovy/util/concurrent/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java index ee59e1e..ac61233 100644 --- a/src/main/java/org/apache/groovy/util/concurrent/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java +++ b/src/main/java/org/apache/groovy/util/concurrent/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java @@ -70,7 +70,7 @@ import static org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Concurre * modifies its weight requires that an update operation is performed on the * map. * <p> - * An {@link org.apache.groovy.util.concurrent.concurrentlinkedhashmap.EvictionListener} may be supplied for notification when an entry + * An {@link EvictionListener} may be supplied for notification when an entry * is evicted from the map. This listener is invoked on a caller's thread and * will not block other threads from operating on the map. An implementation * should be aware that the caller's thread will not expect long execution @@ -205,7 +205,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V> // These fields provide support for notifying a listener. final Queue<Node<K, V>> pendingNotifications; - final org.apache.groovy.util.concurrent.concurrentlinkedhashmap.EvictionListener<K, V> listener; + final EvictionListener<K, V> listener; transient Set<K> keySet; transient Collection<V> values; @@ -1024,7 +1024,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V> try { drainBuffers(); - final int initialCapacity = (weigher == org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weighers.entrySingleton()) + final int initialCapacity = (weigher == Weighers.entrySingleton()) ? Math.min(limit, (int) weightedSize()) : 16; final Set<K> keys = new LinkedHashSet<K>(initialCapacity); @@ -1134,7 +1134,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V> try { drainBuffers(); - final int initialCapacity = (weigher == org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weighers.entrySingleton()) + final int initialCapacity = (weigher == Weighers.entrySingleton()) ? Math.min(limit, (int) weightedSize()) : 16; final Map<K, V> map = new LinkedHashMap<K, V>(initialCapacity); @@ -1510,7 +1510,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V> } /** A listener that ignores all notifications. */ - enum DiscardingListener implements org.apache.groovy.util.concurrent.concurrentlinkedhashmap.EvictionListener<Object, Object> { + enum DiscardingListener implements EvictionListener<Object, Object> { INSTANCE; @Override public void onEviction(Object key, Object value) {} @@ -1537,7 +1537,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V> */ static final class SerializationProxy<K, V> implements Serializable { final EntryWeigher<? super K, ? super V> weigher; - final org.apache.groovy.util.concurrent.concurrentlinkedhashmap.EvictionListener<K, V> listener; + final EvictionListener<K, V> listener; final int concurrencyLevel; final Map<K, V> data; final long capacity; @@ -1581,7 +1581,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V> static final int DEFAULT_CONCURRENCY_LEVEL = 16; static final int DEFAULT_INITIAL_CAPACITY = 16; - org.apache.groovy.util.concurrent.concurrentlinkedhashmap.EvictionListener<K, V> listener; + EvictionListener<K, V> listener; EntryWeigher<? super K, ? super V> weigher; int concurrencyLevel; @@ -1591,10 +1591,10 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V> @SuppressWarnings("unchecked") public Builder() { capacity = -1; - weigher = org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weighers.entrySingleton(); + weigher = Weighers.entrySingleton(); initialCapacity = DEFAULT_INITIAL_CAPACITY; concurrencyLevel = DEFAULT_CONCURRENCY_LEVEL; - listener = (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.EvictionListener<K, V>) DiscardingListener.INSTANCE; + listener = (EvictionListener<K, V>) DiscardingListener.INSTANCE; } /** @@ -1664,9 +1664,9 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V> * @throws NullPointerException if the weigher is null */ public Builder<K, V> weigher(Weigher<? super V> weigher) { - this.weigher = (weigher == org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weighers.singleton()) - ? org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weighers.entrySingleton() - : new BoundedEntryWeigher<K, V>(org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weighers.asEntryWeigher(weigher)); + this.weigher = (weigher == Weighers.singleton()) + ? Weighers.entrySingleton() + : new BoundedEntryWeigher<K, V>(Weighers.asEntryWeigher(weigher)); return this; } @@ -1679,7 +1679,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V> * @throws NullPointerException if the weigher is null */ public Builder<K, V> weigher(EntryWeigher<? super K, ? super V> weigher) { - this.weigher = (weigher == org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weighers.entrySingleton()) + this.weigher = (weigher == Weighers.entrySingleton()) ? Weighers.entrySingleton() : new BoundedEntryWeigher<>(weigher); return this; diff --git a/src/main/java/org/apache/groovy/util/concurrent/concurrentlinkedhashmap/Weighers.java b/src/main/java/org/apache/groovy/util/concurrent/concurrentlinkedhashmap/Weighers.java index ea2bd54..7d31e9a 100644 --- a/src/main/java/org/apache/groovy/util/concurrent/concurrentlinkedhashmap/Weighers.java +++ b/src/main/java/org/apache/groovy/util/concurrent/concurrentlinkedhashmap/Weighers.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.Set; /** - * A common set of {@link org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher} and {@link EntryWeigher} implementations. + * A common set of {@link Weigher} and {@link EntryWeigher} implementations. * * @see <a href="http://code.google.com/p/concurrentlinkedhashmap/"> * http://code.google.com/p/concurrentlinkedhashmap/</a> @@ -41,7 +41,7 @@ public final class Weighers { * @return A entry weigher view of the specified weigher. */ public static <K, V> EntryWeigher<K, V> asEntryWeigher( - final org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<? super V> weigher) { + final Weigher<? super V> weigher) { return (weigher == singleton()) ? Weighers.entrySingleton() : new EntryWeigherView<K, V>(weigher); @@ -67,8 +67,8 @@ public final class Weighers { * @return A weigher where a value takes one unit of capacity. */ @SuppressWarnings({"cast", "unchecked"}) - public static <V> org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<V> singleton() { - return (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<V>) SingletonWeigher.INSTANCE; + public static <V> Weigher<V> singleton() { + return (Weigher<V>) SingletonWeigher.INSTANCE; } /** @@ -86,7 +86,7 @@ public final class Weighers { * * @return A weigher where each byte takes one unit of capacity. */ - public static org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<byte[]> byteArray() { + public static Weigher<byte[]> byteArray() { return ByteArrayWeigher.INSTANCE; } @@ -105,8 +105,8 @@ public final class Weighers { * @return A weigher where each element takes one unit of capacity. */ @SuppressWarnings({"cast", "unchecked"}) - public static <E> org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<? super Iterable<E>> iterable() { - return (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<Iterable<E>>) (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<?>) IterableWeigher.INSTANCE; + public static <E> Weigher<? super Iterable<E>> iterable() { + return (Weigher<Iterable<E>>) (Weigher<?>) IterableWeigher.INSTANCE; } /** @@ -123,8 +123,8 @@ public final class Weighers { * @return A weigher where each element takes one unit of capacity. */ @SuppressWarnings({"cast", "unchecked"}) - public static <E> org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<? super Collection<E>> collection() { - return (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<Collection<E>>) (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<?>) CollectionWeigher.INSTANCE; + public static <E> Weigher<? super Collection<E>> collection() { + return (Weigher<Collection<E>>) (Weigher<?>) CollectionWeigher.INSTANCE; } /** @@ -141,8 +141,8 @@ public final class Weighers { * @return A weigher where each element takes one unit of capacity. */ @SuppressWarnings({"cast", "unchecked"}) - public static <E> org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<? super List<E>> list() { - return (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<List<E>>) (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<?>) ListWeigher.INSTANCE; + public static <E> Weigher<? super List<E>> list() { + return (Weigher<List<E>>) (Weigher<?>) ListWeigher.INSTANCE; } /** @@ -159,8 +159,8 @@ public final class Weighers { * @return A weigher where each element takes one unit of capacity. */ @SuppressWarnings({"cast", "unchecked"}) - public static <E> org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<? super Set<E>> set() { - return (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<Set<E>>) (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<?>) SetWeigher.INSTANCE; + public static <E> Weigher<? super Set<E>> set() { + return (Weigher<Set<E>>) (Weigher<?>) SetWeigher.INSTANCE; } /** @@ -177,15 +177,15 @@ public final class Weighers { * @return A weigher where each entry takes one unit of capacity. */ @SuppressWarnings({"cast", "unchecked"}) - public static <A, B> org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<? super Map<A, B>> map() { - return (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<Map<A, B>>) (org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<?>) MapWeigher.INSTANCE; + public static <A, B> Weigher<? super Map<A, B>> map() { + return (Weigher<Map<A, B>>) (Weigher<?>) MapWeigher.INSTANCE; } static final class EntryWeigherView<K, V> implements EntryWeigher<K, V>, Serializable { static final long serialVersionUID = 1; - final org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<? super V> weigher; + final Weigher<? super V> weigher; - EntryWeigherView(org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<? super V> weigher) { + EntryWeigherView(Weigher<? super V> weigher) { ConcurrentLinkedHashMap.checkNotNull(weigher); this.weigher = weigher; } @@ -205,7 +205,7 @@ public final class Weighers { } } - enum SingletonWeigher implements org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<Object> { + enum SingletonWeigher implements Weigher<Object> { INSTANCE; @Override @@ -214,7 +214,7 @@ public final class Weighers { } } - enum ByteArrayWeigher implements org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<byte[]> { + enum ByteArrayWeigher implements Weigher<byte[]> { INSTANCE; @Override @@ -223,7 +223,7 @@ public final class Weighers { } } - enum IterableWeigher implements org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<Iterable<?>> { + enum IterableWeigher implements Weigher<Iterable<?>> { INSTANCE; @Override @@ -239,7 +239,7 @@ public final class Weighers { } } - enum CollectionWeigher implements org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<Collection<?>> { + enum CollectionWeigher implements Weigher<Collection<?>> { INSTANCE; @Override @@ -248,7 +248,7 @@ public final class Weighers { } } - enum ListWeigher implements org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<List<?>> { + enum ListWeigher implements Weigher<List<?>> { INSTANCE; @Override @@ -257,7 +257,7 @@ public final class Weighers { } } - enum SetWeigher implements org.apache.groovy.util.concurrent.concurrentlinkedhashmap.Weigher<Set<?>> { + enum SetWeigher implements Weigher<Set<?>> { INSTANCE; @Override