[ https://issues.apache.org/jira/browse/GROOVY-9779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17213861#comment-17213861 ]
Daniil Ovchinnikov commented on GROOVY-9779: -------------------------------------------- I also believe this change should be discussed in the mailing list first. It's also a major change which should not occur in the minor version. https://groovy-lang.org/operators.html#_call_operator shows an example with {{call}} omitted _on a local variable_. Local variable calls, as well as calls on something which is not a reference e.g. call on a parenthesised expression, are compiled as if {{call}} was written explicitly. {noformat} foo() -> foo.call() // if `foo` is a variable, this allows to omit `call` foo() -> foo() // if `foo` is not a variable (foo) -> foo.call() foo[bar]() -> foo[bar].call() {noformat} See org.codehaus.groovy.classgen.VariableScopeVisitor#visitMethodCallExpression > Inconsistency with callable properties in static context > -------------------------------------------------------- > > Key: GROOVY-9779 > URL: https://issues.apache.org/jira/browse/GROOVY-9779 > Project: Groovy > Issue Type: Bug > Affects Versions: 3.0.6 > Reporter: Daniil Ovchinnikov > Assignee: Eric Milles > Priority: Major > Fix For: 3.0.7, 4.0.0-alpha-2 > > Time Spent: 0.5h > Remaining Estimate: 0h > > {code:title=playground.groovy} > class C { > def call() { > 42 > } > } > class Container { > static final staticC = new C() > def instanceC = new C() > } > assert Container.staticC() == 42 // works fine > def container = new Container() > assert container.staticC() == 42 // MissingMethodException > assert container.instanceC() == 42 // MissingMethodException > {code} > I'd expect the invocations to fail or to work in both static and instance > contexts. -- This message was sent by Atlassian Jira (v8.3.4#803005)