You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Leonard Brünings (Jira)" <ji...@apache.org> on 2022/04/22 12:30:00 UTC

[jira] [Created] (GROOVY-10592) Property-like access of static methods from Interfaces doesn't work with Groovy 4.x

Leonard Brünings created GROOVY-10592:
-----------------------------------------

             Summary: Property-like access of static methods from Interfaces doesn't work with Groovy 4.x
                 Key: GROOVY-10592
                 URL: https://issues.apache.org/jira/browse/GROOVY-10592
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 4.0.1
            Reporter: Leonard Brünings


Extracted from GROOVY-10590

{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 {
    def "someLibraryMethod returns true"() {
        expect:
        SomeInterface.someVersion == "1.0"
    }
}
{code}

fails with

{noformat}
SomeInterface.someVersion == "1.0"
|             |
|             groovy.lang.MissingPropertyException: No such property: someVersion for class: reproducer.SomeInterface
|             	at reproducer.Reproducer.someLibraryMethod returns true(Reproducer.groovy:11)
interface reproducer.SomeInterface
{noformat}



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