groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [1/4] groovy git commit: Trivial refactoring: remove redundant `contains` check
Date Thu, 19 Apr 2018 08:40:10 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X a3d86ac63 -> 88f1b3002


Trivial refactoring: remove redundant `contains` check

If this set already contains the element, the call of `add` leaves the set unchanged

(cherry picked from commit 20abd83)


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 6006f33250476e1f9e69906c8ba855b06de7128e
Parents: a3d86ac
Author: sunlan <sunlan@apache.org>
Authored: Thu Apr 19 15:41:05 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Thu Apr 19 16:38:22 2018 +0800

----------------------------------------------------------------------
 src/main/groovy/groovy/lang/MetaClassImpl.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/6006f332/src/main/groovy/groovy/lang/MetaClassImpl.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/lang/MetaClassImpl.java b/src/main/groovy/groovy/lang/MetaClassImpl.java
index a6ac877..d137cfd 100644
--- a/src/main/groovy/groovy/lang/MetaClassImpl.java
+++ b/src/main/groovy/groovy/lang/MetaClassImpl.java
@@ -639,9 +639,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
                     }
                 }
                 if (!skip) {
-                    if (!newGroovyMethodsSet.contains(method)) {
-                        newGroovyMethodsSet.add(method);
-                    }
+                    newGroovyMethodsSet.add(method);
                     addMetaMethodToIndex(method, mainClassMethodHeader);
                 }
             }


Mime
View raw message