groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] 06/23: Fix for error message of failed resolve
Date Fri, 11 Oct 2019 13:54:19 GMT
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 4c4bee740b2be2e2b68201e233ea96d1ab98bf38
Author: Eric Milles <eric.milles@thomsonreuters.com>
AuthorDate: Thu Oct 10 14:55:59 2019 -0500

    Fix for error message of failed resolve
    
    "unable to resolve class foo.Bar for annotation"
      instead of
    "unable to resolve class foo.Bar , unable to find class for annotation"
    
    and write arrays as "Type[]" instead of "[LType;" in some cases.
    
    (cherry picked from commit bd2471cac4882717615abc8e1c861f35aee51919)
---
 src/main/java/org/codehaus/groovy/control/ResolveVisitor.java | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java b/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
index b3a9fa6..ac6d110 100644
--- a/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
+++ b/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
@@ -348,7 +348,7 @@ public class ResolveVisitor extends ClassCodeExpressionTransformer {
         if (resolveToInner(type)) return;
         if (resolveToOuterNested(type)) return;
 
-        addError("unable to resolve class " + type.getName() + " " + msg, node);
+        addError("unable to resolve class " + type.toString(false) + msg, node);
     }
 
     // GROOVY-7812(#1): Static inner classes cannot be accessed from other files when running
by 'groovy' command
@@ -1364,7 +1364,7 @@ public class ResolveVisitor extends ClassCodeExpressionTransformer {
     protected Expression transformAnnotationConstantExpression(AnnotationConstantExpression
ace) {
         AnnotationNode an = (AnnotationNode) ace.getValue();
         ClassNode type = an.getClassNode();
-        resolveOrFail(type, ", unable to find class for annotation", an);
+        resolveOrFail(type, " for annotation", an);
         for (Map.Entry<String, Expression> member : an.getMembers().entrySet()) {
             member.setValue(transform(member.getValue()));
         }
@@ -1375,12 +1375,11 @@ public class ResolveVisitor extends ClassCodeExpressionTransformer
{
         List<AnnotationNode> annotations = node.getAnnotations();
         if (annotations.isEmpty()) return;
         Map<String, AnnotationNode> tmpAnnotations = new HashMap<String, AnnotationNode>();
-        ClassNode annType;
         for (AnnotationNode an : annotations) {
             // skip built-in properties
             if (an.isBuiltIn()) continue;
-            annType = an.getClassNode();
-            resolveOrFail(annType, ",  unable to find class for annotation", an);
+            ClassNode annType = an.getClassNode();
+            resolveOrFail(annType, " for annotation", an);
             for (Map.Entry<String, Expression> member : an.getMembers().entrySet())
{
                 Expression newValue = transform(member.getValue());
                 Expression adjusted = transformInlineConstants(newValue);
@@ -1422,7 +1421,6 @@ public class ResolveVisitor extends ClassCodeExpressionTransformer {
                 for (Map.Entry<String, Expression> member : an.getMembers().entrySet())
{
                     member.setValue(transformInlineConstants(member.getValue()));
                 }
-
             }
         } else {
             return ExpressionUtils.transformInlineConstants(exp);


Mime
View raw message