Graeme Rocher created GROOVY-7663:
-------------------------------------

             Summary: Traits enhancement should rename static methodMissing and 
propertyMissing to static versions when weaving methods
                 Key: GROOVY-7663
                 URL: https://issues.apache.org/jira/browse/GROOVY-7663
             Project: Groovy
          Issue Type: Improvement
          Components: Compiler
            Reporter: Graeme Rocher


Given:

{code}
trait Foo {
   static methodMissing(String name, args) {
        println name
   }
}
class Bar implements Foo{}

Bar.callMe()
{code}

The above produces a MissingMethodException. Since the methodMissing definition 
is static the method should be renamed to `$static_methodMissing` (and 
`$static_propertyMissing` for the property version) to align them with the 
internal methods:

https://github.com/apache/incubator-groovy/blob/master/src/main/groovy/lang/MetaClassImpl.java#L108

Note that defining:

{code}
trait Foo {
   static $static_methodMissing(String name, args) {
        println name
   }
}
class Bar implements Foo{}

Bar.callMe()
{code}

Does not work either, so currently there is no way to define a static method 
missing without involving an AST transform.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to