[ https://issues.apache.org/jira/browse/GROOVY-9779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17212406#comment-17212406 ]
Eric Milles commented on GROOVY-9779: ------------------------------------- {{MetaClassImpl#invokeStaticMethod}} does this at the end: {code:java} if (prop != null) { MetaClass propMC = registry.getMetaClass(prop.getClass()); return propMC.invokeMethod(prop, CLOSURE_CALL_METHOD, arguments); } return invokeStaticMissingMethod(sender, methodName, arguments); } {code} This is where a non-closure property is tried as a callable. {{invokeMethod}} ends with [{{invokePropertyOrMissing}}|https://github.com/apache/groovy/blob/master/src/main/java/groovy/lang/MetaClassImpl.java#L1315] which does not try the property as callable unless it is a closure or a script binding variable. > 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 > Priority: Major > > {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)