[
https://issues.apache.org/jira/browse/GROOVY-11827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles resolved GROOVY-11827.
----------------------------------
Resolution: Fixed
https://github.com/apache/groovy/commit/41ab97c78682717f14987fe572cd1d116e4a1363
> 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
> Assignee: Eric Milles
> Priority: Major
>
> 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)