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 2020/05/16 12:18:42 UTC

[groovy] branch GROOVY_3_0_X updated (5e231d3 -> ecf7eb2)

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a change to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git.


    from 5e231d3  GROOVY-9506: Joint compilation is broken (add test case)
     new 8f7c176  Trivial refactoring: remove unnecessary qualifier
     new ecf7eb2  Trivial refactoring: Explicit type can be replaced with <>

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../ConcurrentLinkedHashMap.java                   | 74 +++++++++++-----------
 .../concurrentlinkedhashmap/Weighers.java          | 48 +++++++-------
 2 files changed, 61 insertions(+), 61 deletions(-)


[groovy] 01/02: Trivial refactoring: remove unnecessary qualifier

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 8f7c1761f7165661302b121ee765f99871d7222e
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat May 16 19:50:27 2020 +0800

    Trivial refactoring: remove unnecessary qualifier
    
    (cherry picked from commit 8543712d62e8de6f438d4bd4e73afb1cb4702019)
---
 .../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


[groovy] 02/02: Trivial refactoring: Explicit type can be replaced with <>

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit ecf7eb209dcc44fd77068cffb20c5129956ff70b
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat May 16 19:55:17 2020 +0800

    Trivial refactoring: Explicit type can be replaced with <>
    
    (cherry picked from commit 0d59634be1b62dbc50dbd6425101f19138e3c79e)
---
 .../ConcurrentLinkedHashMap.java                   | 50 +++++++++++-----------
 .../concurrentlinkedhashmap/Weighers.java          |  2 +-
 2 files changed, 26 insertions(+), 26 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 ac61233..cac5cfe 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
@@ -219,15 +219,15 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
     // The data store and its maximum capacity
     concurrencyLevel = builder.concurrencyLevel;
     capacity = new AtomicLong(Math.min(builder.capacity, MAXIMUM_CAPACITY));
-    data = new ConcurrentHashMap<K, Node<K, V>>(builder.initialCapacity, 0.75f, concurrencyLevel);
+    data = new ConcurrentHashMap<>(builder.initialCapacity, 0.75f, concurrencyLevel);
 
     // The eviction support
     weigher = builder.weigher;
     evictionLock = new ReentrantLock();
     weightedSize = new AtomicLong();
-    evictionDeque = new LinkedDeque<Node<K, V>>();
-    writeBuffer = new ConcurrentLinkedQueue<Runnable>();
-    drainStatus = new AtomicReference<DrainStatus>(IDLE);
+    evictionDeque = new LinkedDeque<>();
+    writeBuffer = new ConcurrentLinkedQueue<>();
+    drainStatus = new AtomicReference<>(IDLE);
 
     readBufferReadCount = new long[NUMBER_OF_READ_BUFFERS];
     readBufferWriteCount = new AtomicLong[NUMBER_OF_READ_BUFFERS];
@@ -238,7 +238,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
       readBufferDrainAtWriteCount[i] = new AtomicLong();
       readBuffers[i] = new AtomicReference[READ_BUFFER_SIZE];
       for (int j = 0; j < READ_BUFFER_SIZE; j++) {
-        readBuffers[i][j] = new AtomicReference<Node<K, V>>();
+        readBuffers[i][j] = new AtomicReference<>();
       }
     }
 
@@ -246,7 +246,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
     listener = builder.listener;
     pendingNotifications = (listener == DiscardingListener.INSTANCE)
         ? (Queue<Node<K, V>>) DISCARDING_QUEUE
-        : new ConcurrentLinkedQueue<Node<K, V>>();
+        : new ConcurrentLinkedQueue<>();
   }
 
   /** Ensures that the object is not null. */
@@ -492,7 +492,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
    */
   boolean tryToRetire(Node<K, V> node, WeightedValue<V> expect) {
     if (expect.isAlive()) {
-      final WeightedValue<V> retired = new WeightedValue<V>(expect.value, -expect.weight);
+      final WeightedValue<V> retired = new WeightedValue<>(expect.value, -expect.weight);
       return node.compareAndSet(expect, retired);
     }
     return false;
@@ -510,7 +510,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
       if (!current.isAlive()) {
         return;
       }
-      final WeightedValue<V> retired = new WeightedValue<V>(current.value, -current.weight);
+      final WeightedValue<V> retired = new WeightedValue<>(current.value, -current.weight);
       if (node.compareAndSet(current, retired)) {
         return;
       }
@@ -527,7 +527,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
   void makeDead(Node<K, V> node) {
     for (;;) {
       WeightedValue<V> current = node.get();
-      WeightedValue<V> dead = new WeightedValue<V>(current.value, 0);
+      WeightedValue<V> dead = new WeightedValue<>(current.value, 0);
       if (node.compareAndSet(current, dead)) {
         weightedSize.lazySet(weightedSize.get() - Math.abs(current.weight));
         return;
@@ -719,8 +719,8 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
     checkNotNull(value);
 
     final int weight = weigher.weightOf(key, value);
-    final WeightedValue<V> weightedValue = new WeightedValue<V>(value, weight);
-    final Node<K, V> node = new Node<K, V>(key, weightedValue);
+    final WeightedValue<V> weightedValue = new WeightedValue<>(value, weight);
+    final Node<K, V> node = new Node<>(key, weightedValue);
 
     for (;;) {
       final Node<K, V> prior = data.putIfAbsent(node.key, node);
@@ -781,7 +781,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
     checkNotNull(key);
     checkNotNull(mappingFunction);
 
-    final ObjectHolder<Node<K, V>> objectHolder = new ObjectHolder<Node<K, V>>();
+    final ObjectHolder<Node<K, V>> objectHolder = new ObjectHolder<>();
 
     for (;;) {
       Function<K, Node<K, V>> f = k -> {
@@ -790,8 +790,8 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
         checkNotNull(value);
 
         final int weight = weigher.weightOf(key, value);
-        final WeightedValue<V> weightedValue = new WeightedValue<V>(value, weight);
-        final Node<K, V> node = new Node<K, V>(key, weightedValue);
+        final WeightedValue<V> weightedValue = new WeightedValue<>(value, weight);
+        final Node<K, V> node = new Node<>(key, weightedValue);
 
         objectHolder.setObject(node);
 
@@ -803,8 +803,8 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
       if (null == node) { // the entry is present
         V value = prior.getValue();
         final int weight = weigher.weightOf(key, value);
-        final WeightedValue<V> weightedValue = new WeightedValue<V>(value, weight);
-        node = new Node<K, V>(key, weightedValue);
+        final WeightedValue<V> weightedValue = new WeightedValue<>(value, weight);
+        node = new Node<>(key, weightedValue);
       } else {
         // the return value of `computeIfAbsent` is different from the one of `putIfAbsent`.
         // if the key is absent in map, the return value of `computeIfAbsent` is the newly computed value, but `putIfAbsent` return null.
@@ -887,7 +887,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
     checkNotNull(value);
 
     final int weight = weigher.weightOf(key, value);
-    final WeightedValue<V> weightedValue = new WeightedValue<V>(value, weight);
+    final WeightedValue<V> weightedValue = new WeightedValue<>(value, weight);
 
     final Node<K, V> node = data.get(key);
     if (node == null) {
@@ -917,7 +917,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
     checkNotNull(newValue);
 
     final int weight = weigher.weightOf(key, newValue);
-    final WeightedValue<V> newWeightedValue = new WeightedValue<V>(newValue, weight);
+    final WeightedValue<V> newWeightedValue = new WeightedValue<>(newValue, weight);
 
     final Node<K, V> node = data.get(key);
     if (node == null) {
@@ -1027,7 +1027,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
       final int initialCapacity = (weigher == Weighers.entrySingleton())
           ? Math.min(limit, (int) weightedSize())
           : 16;
-      final Set<K> keys = new LinkedHashSet<K>(initialCapacity);
+      final Set<K> keys = new LinkedHashSet<>(initialCapacity);
       final Iterator<Node<K, V>> iterator = ascending
           ? evictionDeque.iterator()
           : evictionDeque.descendingIterator();
@@ -1137,7 +1137,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
       final int initialCapacity = (weigher == Weighers.entrySingleton())
           ? Math.min(limit, (int) weightedSize())
           : 16;
-      final Map<K, V> map = new LinkedHashMap<K, V>(initialCapacity);
+      final Map<K, V> map = new LinkedHashMap<>(initialCapacity);
       final Iterator<Node<K, V>> iterator = ascending
           ? evictionDeque.iterator()
           : evictionDeque.descendingIterator();
@@ -1473,7 +1473,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
     }
 
     Object writeReplace() {
-      return new SimpleEntry<K, V>(this);
+      return new SimpleEntry<>(this);
     }
   }
 
@@ -1521,7 +1521,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
   static final long serialVersionUID = 1;
 
   Object writeReplace() {
-    return new SerializationProxy<K, V>(this);
+    return new SerializationProxy<>(this);
   }
 
   private void readObject(ObjectInputStream stream) throws InvalidObjectException {
@@ -1544,7 +1544,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
 
     SerializationProxy(ConcurrentLinkedHashMap<K, V> map) {
       concurrencyLevel = map.concurrencyLevel;
-      data = new HashMap<K, V>(map);
+      data = new HashMap<>(map);
       capacity = map.capacity.get();
       listener = map.listener;
       weigher = map.weigher;
@@ -1666,7 +1666,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
     public Builder<K, V> weigher(Weigher<? super V> weigher) {
       this.weigher = (weigher == Weighers.singleton())
           ? Weighers.entrySingleton()
-          : new BoundedEntryWeigher<K, V>(Weighers.asEntryWeigher(weigher));
+          : new BoundedEntryWeigher<>(Weighers.asEntryWeigher(weigher));
       return this;
     }
 
@@ -1693,7 +1693,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
      */
     public ConcurrentLinkedHashMap<K, V> build() {
       checkState(capacity >= 0);
-      return new ConcurrentLinkedHashMap<K, V>(this);
+      return new ConcurrentLinkedHashMap<>(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 7d31e9a..5b7f7a4 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
@@ -44,7 +44,7 @@ public final class Weighers {
       final Weigher<? super V> weigher) {
     return (weigher == singleton())
         ? Weighers.entrySingleton()
-        : new EntryWeigherView<K, V>(weigher);
+        : new EntryWeigherView<>(weigher);
   }
 
   /**