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

Frank Pavageau commented on GROOVY-7711:
----------------------------------------

I've submitted https://github.com/apache/groovy/pull/213 which fixes this issue 
as well as GROOVY-7710 (on which [~githubbot] commented). The fix has been 
decoupled from the one for GROOVY-7420.

> Wrong method resolution for an overridden method with varargs and covariant 
> return type
> ---------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7711
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7711
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.4.5
>            Reporter: Frank Pavageau
>            Assignee: Cédric Champeau
>
> Consider the following code:
> {code}
> class A {}
> class B {
>     Object m(Object[] args) {
>         new Object()
>     }
> }
> class C extends B {
>     A m(Object[] args) {
>         new A()
>     }
> }
> C c = new C()
> A a = c.m()
> {code}
> It has 50% chance of failing the static type check at the last line, because 
> the STC can resolve to the base definition (with an {{Object}} return type) 
> instead of the override, as it doesn't give precedence to the most specific 
> definition in the "varargs with 0 argument" case.
> Like for GROOVY-7710, I have a fix for the bug, but it's also based on my 
> pull request for GROOVY-7420 as it's once again in the same method. It's 
> actually in the same commit, because once refactored a bit, the 2 missing 
> method calls become obvious.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to