[
https://issues.apache.org/jira/browse/GROOVY-11832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18050892#comment-18050892
]
Eric Milles commented on GROOVY-11832:
--------------------------------------
{{org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport#chooseBestMethod}}
culls the list. The issue lies within.
> 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
> Priority: Major
>
> 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 a similar
> method that is also on the grand parent class). When `@CompileStatic` is
> added, the wrong method is invoked (object is called instead of the specific
> type method).
>
> Casting doesn't seem to make a difference on the method invoked. I was not
> able to reproduce this with a simple example, it seems to require some
> combination of generics & inheritance to trigger this.
>
> 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)