groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cédric Champeau <cedric.champ...@gmail.com>
Subject Re: Traits and protected properties
Date Wed, 25 Jan 2017 14:57:19 GMT
oh and that's written in the docs:
http://docs.groovy-lang.org/2.4.0/html/documentation/core-traits.html#_static_methods_properties_and_fields

But who reads the f* manual? :)

2017-01-25 14:54 GMT+01:00 Cédric Champeau <cedric.champeau@gmail.com>:

> Static methods are *copied* to the weaved class. They do not belong to the
> trait itself.
>
> 2017-01-25 14:53 GMT+01:00 Daniel Sun <realbluesun@hotmail.com>:
>
>> Hi Graeme,
>>
>>      Here is my test code, which fails:
>>
>> trait A {
>>     public static String m() { return '123' }
>> }
>>
>> A.m()
>>
>> error messages:
>>
>> groovy.lang.MissingMethodException: No signature of method: static A.m()
>> is
>> applicable for argument types: () values: []
>> Possible solutions: is(java.lang.Object), any(), dump(),
>> any(groovy.lang.Closure), use([Ljava.lang.Object;),
>> tap(groovy.lang.Closure)
>>
>>         at ConsoleScript7.run(ConsoleScript7:5)
>>
>>
>>
>> --
>> View this message in context: http://groovy.329449.n5.nabble
>> .com/Traits-and-protected-properties-tp5738002p5738025.html
>> Sent from the Groovy Dev mailing list archive at Nabble.com.
>>
>
>

Mime
View raw message