You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2025/12/30 17:59:00 UTC
[jira] [Updated] (GROOVY-11827) Static getter with optional parameters inaccessible
[ https://issues.apache.org/jira/browse/GROOVY-11827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-11827:
---------------------------------
Fix Version/s: 5.0.4
> 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
> Fix For: 5.0.4
>
>
> 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)