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 2019/12/09 07:08:36 UTC

[groovy] 04/04: Don't transfer import source ranges to static properties or method calls

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 4a2bc42995f444a15c1e142b48f7985feff23ae5
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Sat Dec 7 14:19:25 2019 -0600

    Don't transfer import source ranges to static properties or method calls
    
    https://github.com/groovy/groovy-eclipse/issues/727
    
    import static Foo.getSomeThing as something
    @groovy.transform.CompileStatic
    class Bar {
      def baz(x, y) {
        something(x, y) // includes "Foo" (line 1, column 14)
      }
    }
    
    (cherry picked from commit e4dbbae65caa277fa0aca289e2863b9c9214be82)
---
 src/main/java/org/codehaus/groovy/control/StaticImportVisitor.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/control/StaticImportVisitor.java b/src/main/java/org/codehaus/groovy/control/StaticImportVisitor.java
index e8557a7..1dea516 100644
--- a/src/main/java/org/codehaus/groovy/control/StaticImportVisitor.java
+++ b/src/main/java/org/codehaus/groovy/control/StaticImportVisitor.java
@@ -558,11 +558,11 @@ public class StaticImportVisitor extends ClassCodeExpressionTransformer {
     }
 
     private static PropertyExpression newStaticPropertyX(ClassNode type, String name) {
-        return new PropertyExpression(new ClassExpression(type), name);
+        return new PropertyExpression(new ClassExpression(type.getPlainNodeReference()), name);
     }
 
     private static StaticMethodCallExpression newStaticMethodCallX(ClassNode type, String name, Expression args) {
-        return new StaticMethodCallExpression(type, name, args);
+        return new StaticMethodCallExpression(type.getPlainNodeReference(), name, args);
     }
 
     protected SourceUnit getSourceUnit() {