Repository: groovy
Updated Branches:
  refs/heads/master ef2fbe68d -> c01db1539


Improve the robustness of resolving generics


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

Branch: refs/heads/master
Commit: c01db1539ef40adf8b6406e2eced3fecc89616c1
Parents: ef2fbe6
Author: sunlan <sun...@apache.org>
Authored: Fri May 18 01:48:12 2018 +0800
Committer: sunlan <sun...@apache.org>
Committed: Fri May 18 01:48:12 2018 +0800

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


http://git-wip-us.apache.org/repos/asf/groovy/blob/c01db153/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 9ceab30..c3939b2 100644
--- a/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
+++ b/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
@@ -77,6 +77,7 @@ import java.util.Set;
 
 import static org.codehaus.groovy.ast.tools.GeneralUtils.inSamePackage;
 import static org.codehaus.groovy.ast.tools.GeneralUtils.isDefaultVisibility;
+import static org.codehaus.groovy.runtime.DefaultGroovyMethods.asBoolean;
 
 /**
  * Visitor to resolve Types and convert VariableExpression to
@@ -92,6 +93,7 @@ public class ResolveVisitor extends 
ClassCodeExpressionTransformer {
     public static final String[] DEFAULT_IMPORTS = {"java.lang.", "java.io.", 
"java.net.", "java.util.", "groovy.lang.", "groovy.util."};
     private static final String BIGINTEGER_STR = "BigInteger";
     private static final String BIGDECIMAL_STR = "BigDecimal";
+    public static final String QUESTION_MARK = "?";
 
     private ClassNode currentClass;
     private final CompilationUnit compilationUnit;
@@ -1462,7 +1464,7 @@ public class ResolveVisitor extends 
ClassCodeExpressionTransformer {
             ClassNode classNode = type.getType();
             String name = type.getName();
             ClassNode[] bounds = type.getUpperBounds();
-            boolean isWild = "?".equals(name);
+            boolean isWild = QUESTION_MARK.equals(name);
             boolean toDealWithGenerics = 0 == level || (level > 0 && null != 
genericParameterNames.get(name));
 
             if (bounds != null) {
@@ -1481,7 +1483,7 @@ public class ResolveVisitor extends 
ClassCodeExpressionTransformer {
                         resolveOrFail(upperBound, classNode);
                     }
 
-                    if (upperBound.isUsingGenerics()) {
+                    if (asBoolean(upperBound.isUsingGenerics())) {
                         upperBoundsWithGenerics.add(new Tuple2<>(upperBound, 
type));
                     }
                 }

Reply via email to