[
https://issues.apache.org/jira/browse/GROOVY-10590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17525892#comment-17525892
]
Leonard Brünings edited comment on GROOVY-10590 at 4/21/22 5:42 PM:
--------------------------------------------------------------------
Ok, but {{SomeInterface.someVersion}} should work right?
I also reported it to IntelliJ as they currently treat this as {{Unnecessary
qualified reference}}
https://youtrack.jetbrains.com/issue/IDEA-292716/Unnecessary-qualified-reference-wrongly-reported-for-%22inherited%22
was (Author: leonard84):
Ok, but {{SomeInterface.someVersion}} should work right?
> 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)