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

Eric Milles commented on GROOVY-10962:
--------------------------------------

Just a quick note, the static method is invoked if {{@CompileStatic}} is in 
effect, in case you need a short-term workaround (besides calling the method 
directly).

> Instance "isser" prevents resolving of static "getter"
> ------------------------------------------------------
>
>                 Key: GROOVY-10962
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10962
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.9
>            Reporter: Philip Markus
>            Assignee: Eric Milles
>            Priority: Major
>
> While upgrading the Groovy-Version in our application, we noticed, like 
> others, that the priority of issers and getters have changed. This has 
> already been confirmed as intended behavior, but there seems to be some odd 
> behavior with static and instance accessors.
> When having a class with a static get-method that also has an instance 
> is-method, trying to access the static property via the class name an 
> exception is raised: *groovy.lang.MissingPropertyException: No such property: 
> x for class: mypackage.MyClass  Possible solutions: x*
> You can recreate this rather easily:
>  
> {code:java}
> class Test
> {
>   static String getTestProperty { "test" }
>   boolean isTestProperty { true }
> }
> Test.testProperty // => groovy.lang.MissingPropertyException
> {code}
>  
> Given that the property is called from a static context, one would assume, 
> that the instance method isTestProperty would not be in the way. However it 
> is. Removing the method, makes that static getTestProperty available again 
> via Test.testProperty.
> Is this also intended behavior?



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

Reply via email to