James Daugherty created GROOVY-11832:
----------------------------------------

             Summary: CompileStatic causes wrong method to be invoked
                 Key: GROOVY-11832
                 URL: https://issues.apache.org/jira/browse/GROOVY-11832
             Project: Groovy
          Issue Type: Bug
          Components: Static compilation
    Affects Versions: 4.0.29
         Environment: Groovy 4.0.29, latest mac os, java 17
            Reporter: James Daugherty


I have been working on upgrading a Spring Boot Batch project that uses groovy 
and found an issue in Groovy where the wrong method is invoked if the code is 
annotated with CompileStatic.

 

The class has 2 forms of a `listener` method - one that takes a specific type 
and one that takes Object.  The specific type method is on the grand parent 
class while the object method is on the lowest class (overrides the grand 
parent method).  When `@CompileStatic` is added, the wrong method is invoked 
(object is called instead of the specific type method).  

 

Test project is here: [https://github.com/jdaugherty/groovy-issue-wrong-method]

 

Run the test `WrongResolutionSpec` to verify this behavior.



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

Reply via email to