[ 
https://issues.apache.org/jira/browse/GROOVY-12117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18092438#comment-18092438
 ] 

ASF GitHub Bot commented on GROOVY-12117:
-----------------------------------------

eric-milles commented on code in PR #2644:
URL: https://github.com/apache/groovy/pull/2644#discussion_r3494547955


##########
src/main/java/org/codehaus/groovy/transform/trait/TraitReceiverTransformer.java:
##########
@@ -414,6 +414,19 @@ private static MethodNode findConcreteMethod(final 
ClassNode traitClass, final S
                     return methodNode;
                 }
             }
+            // GROOVY-12117: when a co-compiled super trait has not been 
transformed
+            // yet, its helper is still an empty GROOVY-7909 stub, so the 
lowered
+            // static above is not found. The original static is still 
declared on
+            // the trait node at this point, so resolve it there. This keeps 
the
+            // rewrite independent of the order in which sibling traits are
+            // transformed (GEP-22 P1' dispatch consistency); the helper 
resolves
+            // identically once every trait is lowered, so this only matters 
for
+            // the not-yet-lowered super trait.
+            for (MethodNode methodNode : 
superTrait.getDeclaredMethods(methodName)) {
+                if (methodNode.isPublic() && methodNode.isStatic()) {
+                    return methodNode;
+                }
+            }
         }
 
         return null;

Review Comment:
   It looks like the loop above this just needs the parameter check dropped, 
instead of adding a full second loop.





> Resolution of inherited static trait method from sub-trait body is 
> transform-order dependent
> --------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12117
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12117
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Priority: Major
>
> See: https://github.com/apache/grails-core/pull/15557#issuecomment-4833554145



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to