Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Capture one annotated parameter amongst many

Sweet, 

this was fast. Thanks.
This fix will help me a lot. 


Christian


Andy Clement wrote:
> 
> Me again,
> 
> I raised it as https://bugs.eclipse.org/bugs/show_bug.cgi?id=293203
> and just committed the fix.  It will be in an AJ dev build today then
> an AJDT in a few days.
> 
> (This is the problem of (..,String,..) matching and not (..,@NN
> (String),..) )
> 
> Andy
> 
> 2009/10/23 Andy Clement <andrew.clement@xxxxxxxxx>:
>> Hi,
>>
>> If:
>>
>> execution(* *.* (..,String,..))
>>
>> matches then
>>
>> execution(* *(..,@NN (String),..))
>>
>> should too - so that is a bug. I'll take a look at it in a second.
>>
>>> Would there be any way to additionally expose such a parameter ? (
>>> args(..,param,..) is not allowed )
>>
>> This is a problem we`ve had for a while.  There is currently no state
>> maintained such that the args() can see which thing actually matched
>> in execution.  For now, you need to grab the thisJoinPoint.getArgs()
>> and look through yourself in your advice.  I'd like to solve the
>> general problem of just writing advice that wants any annotated
>> parameter and you don't care where it is, but I can't get the syntax
>> right (and have it result in an implementation that can be implemented
>> in a short period of time).
>>
>> Andy
>>
>> 2009/10/22 Christian Laireiter <Laireiter@xxxxxx>:
>>>
>>> Hello there,
>>>
>>> I've got a little problem, I haven't been able to solve.
>>>
>>> What I'd like to have:
>>> Advise executions of methods, which have at least one parameter with a
>>> specific annotation (say @NN).
>>>
>>>  public void arbitrary (Object param1, Object param2, @NN String param3,
>>> Object Param4, ...)
>>>
>>> (Consider param3 is a String and point1() will apply)
>>>
>>>        public pointcut point1() : execution(* *.* (..,String,..));
>>>
>>>        public pointcut point2() : execution(* *(..,@NN (String),*,*));
>>>
>>>        public pointcut point3() : execution(* *(*,*,@NN (String),*,*));
>>>
>>>        public pointcut point4() : execution(* *(Object,Object,@NN
>>> (String),Object,Object));
>>>
>>> Now the interesting part here is the pointcut "point1()", which applies
>>> to
>>> "arbitrary(...)".
>>> Even point2() applies.
>>>
>>> However the following does not:
>>>
>>>       public pointcut point5 () :execution(* *(..,@NN (String),..));
>>>
>>> Do I make a mistake by assuming this should work, or do I misunderstand
>>> something ?
>>>
>>> ---------
>>>
>>> If this can be solved, and you are not tired of one more question:
>>>
>>> Would there be any way to additionally expose such a parameter ? (
>>> args(..,param,..) is not allowed )
>>>
>>>
>>> Thank you for reading (and considering to answer :) )
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Capture-one-annotated-parameter-amongst-many-tp26021577p26021577.html
>>> Sent from the AspectJ - users mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>
>>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Capture-one-annotated-parameter-amongst-many-tp26021577p26039635.html
Sent from the AspectJ - users mailing list archive at Nabble.com.



Back to the top