[ 
https://issues.apache.org/jira/browse/GROOVY-11323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-11323:
---------------------------------
    Fix Version/s: 3.0.21

> Interface default method and static import precedence
> -----------------------------------------------------
>
>                 Key: GROOVY-11323
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11323
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 3.0.21, 4.0.19, 5.0.0-alpha-6
>
>
> Consider the following:
> {code:groovy}
> import static Bar.*
> interface Foo {
>     default m() { 'Foo' }
> }
> class Bar {
>     static  m() { 'Bar' }
> }
> class Baz implements Foo {
>     void test() {
>         assert m() == 'Foo'
>     }
> }
> new Baz().test()
> {code}
> The implicit-this method call "m()" has two possible sources.  Since {{Foo}} 
> is a super-interface, it should be the one selected.  However, 
> {{StaticImportVisitor}} does not detect that option and replaces the method 
> call with "Bar.m()".



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

Reply via email to