You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/04/21 14:13:00 UTC

[jira] [Resolved] (GROOVY-10590) Static methods of interfaces are not resolved anymore in implementig classes with Groovy 4.x

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

Eric Milles resolved GROOVY-10590.
----------------------------------
    Resolution: Information Provided

> Static methods of interfaces are not resolved anymore in implementig classes with Groovy 4.x
> --------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10590
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10590
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.1
>            Reporter: Leonard Brünings
>            Assignee: Eric Milles
>            Priority: Major
>
> {code:java|title=SomeInterface.java}
> public interface SomeInterface {
>     static String getSomeVersion() {
>         return "1.0";
>     }
> }
> {code}
> {code:groovy|title=Reproducer.groovy}
> import spock.lang.Specification
> class Reproducer extends Specification implements SomeInterface{
>     def "someLibraryMethod returns true"() {
>         expect:
>         someVersion == "1.0"
>     }
> }
> {code}
> Succeeds in 3.x but fails in 4.x
> {noformat}
> Condition failed with Exception:
> someVersion == "1.0"
> |
> groovy.lang.MissingPropertyException: No such property: someVersion for class: reproducer.Reproducer
> 	at reproducer.Reproducer.someLibraryMethod returns true(Reproducer.groovy:11)
> {noformat}
> Method variation fails as well
> {code:groovy}
> class Reproducer extends Specification implements SomeInterface {
>     def "someLibraryMethod returns true"() {
>         expect:
>         getSomeVersion() == "1.0"
>     }
> }
> {code}
> Even the qualified property version fails
> {code:groovy}
> class Reproducer extends Specification implements SomeInterface {
>     def "someLibraryMethod returns true"() {
>         expect:
>         SomeInterface.someVersion == "1.0"
>     }
> }
> {code}
> Only the qualified method version works.
> {code:groovy}
> class Reproducer extends Specification implements SomeInterface {
>     def "someLibraryMethod returns true"() {
>         expect:
>         SomeInterface.getSomeVersion() == "1.0"
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)