posted 10 years ago
I was amazed the way groovy's Trait allows us to extend behavior of any object.
For example:
Output: Parent: Hello Groovy
HelloChild is a final class ,I want to understand the way groovy implements this feature. According to my understanding when groovy deals with 'as' clause
it creates a proxy which extends the instance class (HelloChild) & implements the Trait. But since HelloChild is a final class i am not sure of how it works.
May be through some byte code instrumentation ? Not sure. Would be great if any ranchers knows of the internals and share their knowledge.
Regards,
Shroff.