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 2019/11/29 06:14:01 UTC

[groovy] branch GROOVY_3_0_X updated: Trivial refactoring: Explicit type can be replaced with <>

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


The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
     new adf9793  Trivial refactoring: Explicit type can be replaced with <>
adf9793 is described below

commit adf979382dcb7ace03e9f0062d774e567f4e4e4a
Author: Daniel Sun <su...@apache.org>
AuthorDate: Fri Nov 29 14:04:10 2019 +0800

    Trivial refactoring: Explicit type can be replaced with <>
    
    (cherry picked from commit ae7450c2cdd5c173f7e62a938ce1cf25717138d8)
---
 src/main/java/groovy/lang/MetaClassImpl.java | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/java/groovy/lang/MetaClassImpl.java b/src/main/java/groovy/lang/MetaClassImpl.java
index e82ba38..5e10569 100644
--- a/src/main/java/groovy/lang/MetaClassImpl.java
+++ b/src/main/java/groovy/lang/MetaClassImpl.java
@@ -146,12 +146,12 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
 
     private final Index classPropertyIndex = new MethodIndex();
     private final SingleKeyHashMap staticPropertyIndex = new SingleKeyHashMap();
-    private final Map<String, MetaMethod> listeners = new HashMap<String, MetaMethod>();
-    private final List<MetaMethod> allMethods = new ArrayList<MetaMethod>();
+    private final Map<String, MetaMethod> listeners = new HashMap<>();
+    private final List<MetaMethod> allMethods = new ArrayList<>();
     // we only need one of these that can be reused over and over.
     private final MetaProperty arrayLengthProperty = new MetaArrayLengthProperty();
     private final Index classPropertyIndexForSuper = new MethodIndex();
-    private final Set<MetaMethod> newGroovyMethodsSet = new HashSet<MetaMethod>();
+    private final Set<MetaMethod> newGroovyMethodsSet = new HashSet<>();
     private final MetaMethod[] myNewMetaMethods;
     private final MetaMethod[] additionalMetaMethods;
 
@@ -185,7 +185,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
         metaMethodIndex = new MetaMethodIndex(theCachedClass);
         final MetaMethod[] metaMethods = theCachedClass.getNewMetaMethods();
         if (add != null && !(add.length == 0)) {
-            List<MetaMethod> arr = new ArrayList<MetaMethod>();
+            List<MetaMethod> arr = new ArrayList<>();
             arr.addAll(Arrays.asList(metaMethods));
             arr.addAll(Arrays.asList(add));
             myNewMetaMethods = arr.toArray(MetaMethod.EMPTY_ARRAY);
@@ -436,7 +436,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
     }
 
     protected LinkedList<CachedClass> getSuperClasses() {
-        LinkedList<CachedClass> superClasses = new LinkedList<CachedClass>();
+        LinkedList<CachedClass> superClasses = new LinkedList<>();
 
         if (theClass.isInterface()) {
             superClasses.addFirst(ReflectionCache.OBJECT_CLASS);
@@ -2102,7 +2102,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
             }
         }
 
-        return new Tuple2<MetaMethod, MetaProperty>(method, mp);
+        return new Tuple2<>(method, mp);
     }
 
     private static MetaMethod getCategoryMethodMissing(Class sender) {
@@ -2331,7 +2331,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
     @SuppressWarnings("unchecked")
     private void setupProperties(PropertyDescriptor[] propertyDescriptors) {
         if (theCachedClass.isInterface) {
-            LinkedList<CachedClass> superClasses = new LinkedList<CachedClass>();
+            LinkedList<CachedClass> superClasses = new LinkedList<>();
             superClasses.add(ReflectionCache.OBJECT_CLASS);
             Set interfaces = theCachedClass.getInterfaces();
 
@@ -2356,7 +2356,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
             makeStaticPropertyIndex();
         } else {
             LinkedList<CachedClass> superClasses = getSuperClasses();
-            LinkedList<CachedClass> interfaces = new LinkedList<CachedClass>(theCachedClass.getInterfaces());
+            LinkedList<CachedClass> interfaces = new LinkedList<>(theCachedClass.getInterfaces());
             // sort interfaces so that we may ensure a deterministic behaviour in case of
             // ambiguous fields (class implementing two interfaces using the same field)
             if (interfaces.size() > 1) {
@@ -2539,7 +2539,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
         }
     }
 
-    private static final ConcurrentMap<String, String> PROP_NAMES = new ConcurrentHashMap<String, String>(1024);
+    private static final ConcurrentMap<String, String> PROP_NAMES = new ConcurrentHashMap<>(1024);
 
     private static String getPropName(String methodName) {
         return PROP_NAMES.computeIfAbsent(methodName, k -> {
@@ -3454,7 +3454,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
      * @return A list of MetaMethods
      */
     public List<MetaMethod> getMetaMethods() {
-        return new ArrayList<MetaMethod>(newGroovyMethodsSet);
+        return new ArrayList<>(newGroovyMethodsSet);
     }
 
     protected void dropStaticMethodCache(String name) {