Trivial refactoring: extract variable

(cherry picked from commit ebdfa19)


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 9042e3ded684ee1f927655939a63a61445ff20f4
Parents: 6e2c973
Author: danielsun1106 <realblue...@hotmail.com>
Authored: Fri Apr 6 14:46:13 2018 +0800
Committer: danielsun1106 <realblue...@hotmail.com>
Committed: Fri Apr 6 15:08:39 2018 +0800

----------------------------------------------------------------------
 .../java/org/codehaus/groovy/control/ResolveVisitor.java  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/9042e3de/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java 
b/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
index 6065a6d..bc3630f 100644
--- a/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
+++ b/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
@@ -368,15 +368,17 @@ public class ResolveVisitor extends 
ClassCodeExpressionTransformer {
         // test if vanilla name is current class name
         if (currentClass == type) return true;
 
-        if (genericParameterNames.get(type.getName()) != null) {
-            GenericsType gt = genericParameterNames.get(type.getName());
+        String typeName = type.getName();
+
+        if (genericParameterNames.get(typeName) != null) {
+            GenericsType gt = genericParameterNames.get(typeName);
             type.setRedirect(gt.getType());
-            type.setGenericsTypes(new GenericsType[]{gt});
+            type.setGenericsTypes(new GenericsType[]{ gt });
             type.setGenericsPlaceHolder(true);
             return true;
         }
 
-        if (currentClass.getNameWithoutPackage().equals(type.getName())) {
+        if (currentClass.getNameWithoutPackage().equals(typeName)) {
             type.setRedirect(currentClass);
             return true;
         }

Reply via email to