groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Trivial refactoring
Date Tue, 26 Jun 2018 00:51:09 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 896ec206f -> ca74e69f6


Trivial refactoring

(cherry picked from commit 419ca1c)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: ca74e69f60048b9141ffe926964ab321c941a985
Parents: 896ec20
Author: sunlan <sunlan@apache.org>
Authored: Tue Jun 26 08:50:39 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Tue Jun 26 08:51:02 2018 +0800

----------------------------------------------------------------------
 src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java   | 5 +----
 .../org/codehaus/groovy/runtime/metaclass/MetaMethodIndex.java  | 4 ++--
 2 files changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/ca74e69f/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java b/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java
index e2dedf7..9cd26a0 100644
--- a/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java
+++ b/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java
@@ -321,10 +321,7 @@ public class ClassNodeUtils {
      * @throws NullPointerException if either of the given nodes are null
      */
     public static boolean samePackageName(ClassNode first, ClassNode second) {
-        String firstPackage = first.getPackageName();
-        String secondPackage = second.getPackageName();
-        return (Objects.equals(firstPackage, secondPackage))
-                || (firstPackage != null && firstPackage.equals(secondPackage));
+        return Objects.equals(first.getPackageName(), second.getPackageName());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/ca74e69f/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaMethodIndex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaMethodIndex.java b/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaMethodIndex.java
index 7268397..6133ccf 100644
--- a/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaMethodIndex.java
+++ b/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaMethodIndex.java
@@ -208,7 +208,7 @@ public class MetaMethodIndex {
         int h = hash(31 * cls.hashCode() + name.hashCode());
         Entry e = table[h & (table.length - 1)];
         for (; e != null; e = e.nextHashEntry)
-            if (e.hash == h && cls == e.cls && (Objects.equals(e.name, name)
|| e.name.equals(name)) )
+            if (e.hash == h && cls == e.cls && Objects.equals(e.name, name)
)
                 return e;
 
         return null;
@@ -221,7 +221,7 @@ public class MetaMethodIndex {
         final int index = h & (t.length - 1);
         Entry e = t[index];
         for (; e != null; e = e.nextHashEntry)
-            if (e.hash == h && cls == e.cls && (Objects.equals(e.name, name)
|| e.name.equals(name)) )
+            if (e.hash == h && cls == e.cls && Objects.equals(e.name, name)
)
                 return e;
 
         Entry entry = new Entry();


Mime
View raw message