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 2020/07/09 20:20:36 UTC

[groovy] branch master updated: GROOVY-9601: tweak checks

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 0315bb0  GROOVY-9601: tweak checks
0315bb0 is described below

commit 0315bb0c37bd80f3bb6862fc7e5b402639f80f27
Author: Daniel Sun <su...@apache.org>
AuthorDate: Fri Jul 10 04:17:09 2020 +0800

    GROOVY-9601: tweak checks
---
 src/main/java/org/codehaus/groovy/classgen/VariableScopeVisitor.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/codehaus/groovy/classgen/VariableScopeVisitor.java b/src/main/java/org/codehaus/groovy/classgen/VariableScopeVisitor.java
index 74f8aa1..411d51a 100644
--- a/src/main/java/org/codehaus/groovy/classgen/VariableScopeVisitor.java
+++ b/src/main/java/org/codehaus/groovy/classgen/VariableScopeVisitor.java
@@ -167,6 +167,8 @@ public class VariableScopeVisitor extends ClassCodeVisitorSupport {
     }
 
     private Variable findClassMember(final ClassNode node, final String name) {
+        final boolean abstractType = node.isAbstract();
+
         for (ClassNode cn = node; cn != null && !cn.equals(ClassHelper.OBJECT_TYPE); cn = cn.getSuperClass()) {
             if (cn.isScript()) {
                 return new DynamicVariable(name, false);
@@ -181,7 +183,7 @@ public class VariableScopeVisitor extends ClassCodeVisitorSupport {
             }
 
             for (MethodNode mn : cn.getMethods()) {
-                if (name.equals(getPropertyName(mn))) {
+                if ((abstractType || !mn.isAbstract()) && name.equals(getPropertyName(mn))) {
                     FieldNode fn = new FieldNode(name, mn.getModifiers() & 0xF, ClassHelper.OBJECT_TYPE, cn, null);
                     fn.setHasNoRealSourcePosition(true);
                     fn.setDeclaringClass(cn);