Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: [groovy-user] AspectG?

inline...

On Mon, Jun 14, 2010 at 7:05 PM, Pierre Thibault
<pierre.thibault1@xxxxxxxxx> wrote:
> You can create your aspects in AspectJ and do the weaving on the .class
> files generated by Groovy.
Assuming you know what the signatures of Groovy methods are, I suppose
you could write AspectJ aspects.  Questions:

What's the pointcut for a Groovy method "def go(foo)"?  What's the
pointcut for calls to the closure invoked like "list.each { foo(it) }"
so that I can apply around advice to it?

It seems as though there are opportunities to Groovify pointcuts,
advice & ITDs.  If I have to write everything in AspectJ, it seems
like a less desirable solution.

Also, what if I'm interpreting scripts instead of compiling my Groovy
classes?  How do I make aspects apply then?

> You can also create a little shell in AspectJ
> delegating the work to an implementation in Groovy.
>
Seems like a kludge to me.  I'm curious about a full-blown, native
Groovy version of AspectJ.

-matthew

> 2010/6/14 Matthew Adams <matthew@xxxxxxxxxxxxxxx>
>>
>> [NB:  crossposting to both groovy & aspectj user lists.  Replying to
>> both would be cool.]
>>
>> Hi all,
>>
>> For me, using Groovy is like programming with lubrication -- makes
>> programming slicker and faster with less resistance.  However, since I
>> use AspectJ with Java, I'm not willing to give up the power of aspects
>> (pointcuts & advice) and intertype declarations.  I would make the
>> leap wholeheartedly to Groovy and probably never look back if I knew
>> how I could use these AspectJ constructs in Groovy.
>>
>> Is there a definitive road map for "AspectG", as it were?  How does
>> the dynamic nature of Groovy and Groovy's MOP affect the strong syntax
>> affinity that AspectJ has in Java land?
>>
>> I'm aware of Groovy's (and Objective-C's) categories, but that seems
>> to fall short of the full power of AspectJ, plus, I'm not sure that I
>> necessarily like Groovy categories' "use" syntax, unless I'm
>> misunderstanding it.  (Note that I would make the same argument for
>> Objective-C -- is there an AspectOC on the horizon?)
>>
>> I've also seen http://www.infoq.com/articles/aop-with-groovy and
>> http://groovy.codehaus.org/Using+invokeMethod+and+getProperty which
>> discuss some AOP concepts in Groovy, but that kind of method
>> interception seems to provide AOP support on an individual class basis
>> (and only for method invocation, leaving out constructor invocation
>> interception, field access interception, etc).
>>
>> -matthew
>>
>> --
>> mailto:matthew@xxxxxxxxxxxxxxx
>> skype:matthewadams12
>> yahoo:matthewadams
>> aol:matthewadams12
>> google-talk:matthewadams12@xxxxxxxxx
>> msn:matthew@xxxxxxxxxxxxxxx
>> http://matthewadams.me
>> http://www.linkedin.com/in/matthewadams
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>
>
> --
> A+
>
> -------------
> Pierre
>



-- 
mailto:matthew@xxxxxxxxxxxxxxx
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:matthewadams12@xxxxxxxxx
msn:matthew@xxxxxxxxxxxxxxx
http://matthewadams.me
http://www.linkedin.com/in/matthewadams


Back to the top