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/04/19 07:41:12 UTC

groovy git commit: Trivial refactoring: remove redundant `contains` check

Repository: groovy
Updated Branches:
  refs/heads/master 923f788f8 -> 20abd8312


Trivial refactoring: remove redundant `contains` check

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


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

Branch: refs/heads/master
Commit: 20abd83126055a6210908fa6b6dc1c24c6c2b335
Parents: 923f788
Author: sunlan <su...@apache.org>
Authored: Thu Apr 19 15:41:05 2018 +0800
Committer: sunlan <su...@apache.org>
Committed: Thu Apr 19 15:41:05 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/20abd831/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 ab8b655..7be4264 100644
--- a/src/main/groovy/groovy/lang/MetaClassImpl.java
+++ b/src/main/groovy/groovy/lang/MetaClassImpl.java
@@ -641,9 +641,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
                     }
                 }
                 if (!skip) {
-                    if (!newGroovyMethodsSet.contains(method)) {
-                        newGroovyMethodsSet.add(method);
-                    }
+                    newGroovyMethodsSet.add(method);
                     addMetaMethodToIndex(method, mainClassMethodHeader);
                 }
             }