You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2018/08/06 14:20:02 UTC
[jira] [Closed] (GROOVY-7663) Traits enhancement should rename
static methodMissing and propertyMissing to static versions when weaving
methods
[ https://issues.apache.org/jira/browse/GROOVY-7663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-7663.
-----------------------------
> 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
> Assignee: Paul King
> Priority: Major
> Fix For: 2.4.8
>
>
> 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
(v7.6.3#76005)