Aleks Tamarkin created GROOVY-11827:
---------------------------------------

             Summary: Static getter with optional parameters inaccessible
                 Key: GROOVY-11827
                 URL: https://issues.apache.org/jira/browse/GROOVY-11827
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 5.0.3
            Reporter: Aleks Tamarkin


The following code should run but produces the error


{code:java}
class Foo {
    static getBar(value = null) { println "value is $value" }
    static run() { bar }
}
Foo.run() {code}

Produces the error 


{code:java}
Apparent variable 'bar' was found in a static scope but doesn't refer to a 
local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable 
from a static context.
You misspelled a classname or statically imported field. Please check the 
spelling.
You attempted to use a method 'bar' but left out brackets in a place not 
allowed by the grammar.
 at line: 3, column: 20                                                         
              {code}

If removing the optional argument or calling `Foo.bar` it works.



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

Reply via email to