I would suggest to repost this issue under a new topic. (e.g. args pointcut designature and null arguments).
So it is more likely to get a post from the developers.

Here you find an older  discussion of this topic:
http://dev.eclipse.org/mhonarc/lists/aspectj-dev/msg01676.html

So args ha a instanceof semantic and one would aspect null values not to match. Normally, with statically determinable pointcuts this is not the case in aspectj:

        before(Runnable arg): execution(* *.*(.., Runnable)) && args(.., arg){
                System.err.println("Arg: " + arg);
        }

        public void test1(Object test, Runnable runnable) {
                
        }

        public static void main(String[] args) {
                new SignatureTest().test1(null, null);
        }

I find in the console a match: Arg: null

So this leads to two questions:

Why is the default behaviour in aspectj inconsistent and matches null args?

I guess for statically determinable pointcuts this runtiime check is omitted.

But your pointcut is statically determinable and should macth null args.

The second question is why?

What is your aspectj version and what compiler switches did you set?
Do you use ajdt and eclipse as a development environment? How does
the annotation for the matching signature looks like (Does it have a runtime
check? Is it advised with more than advice?)

As a workaround omit the binding and get the value for the transaction object from
thisJoinPoint.getArgs(),


Am 08.02.2007 um 12:54 schrieb David Hatton ((AT/LMI)):

Hi again,

We're getting this to work:

pointcut bcMethodsTransactionAfterMethods(Transaction tx):
(execution (!private * com.ericsson.nms.cif.cs.*.*(.., Transaction)) && args(.., tx) );


before(Transaction tx): bcMethodsTransactionBeforeMethods(tx) {
   CsTrace.traceTransaction(
      thisJoinPointStaticPart.getSignature().getDeclaringTypeName(),
      thisJoinPointStaticPart.getSignature().getName(),
      thisJoinPoint.getArgs(),
      tx);
}


But it doesn't seem to work when the Transaction object is null? Is that expected?

/David


From: [EMAIL PROTECTED] [mailto:aspectj-users- [EMAIL PROTECTED] On Behalf Of Vincenz Braun
Sent: 07 February 2007 14:50
To: [email protected]
Subject: Re: [aspectj-users] Matching methods with a particular argument type

One can use .. in the front and the back in method patterns (more than once).
But you get a compilation error when using more than one .. in
args pointcut designators. This is a compiler limitation because of ambiguousness
in the binding.

And a
before(): execution(* *.*(.., String, ..)) {

}
public class SignatureTest {

public void test(String arg) {

}
}

will match the SignatureTest.test(String).

And a
before(String arg): execution(* *.*(.., String, ..)) && args(.., args, ...) {

}
will cause a compilation error: uses more than one .. in args (compiler limitation)

Am 07.02.2007 um 15:20 schrieb Eric Bodden:

No, I think think this is even syntactically wrong cause you cannot
have ".." both in the front and back. IMHO there is no way to match on
methods which have a String parameter at an arbitrary place (without
using reflection at least).

Eric

On 2/7/07, Marco Mistroni <[EMAIL PROTECTED]> wrote:
Hi,



Would the last case match:

   com.ericsson.nms.cif.cs.Aclass.Amethod(String something); ???


my 2 cents here.
Not in my opinion...
It will match any methods which have 3 parameters in which the second one is a String.....

anyone could correct me if i m wrong?

regards
 marco



Regards,
David


_______________________________________________
aspectj-users mailing list
[email protected]
<https://dev.eclipse.org/mailman/listinfo/aspectj-users> https:// dev.eclipse.org/mailman/listinfo/aspectj-users





_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users




--
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

--

vincenz braun
evelox Consulting GmbH & Co. KG

email:  [EMAIL PROTECTED]
phone: +49 700 VINCEBRAUN
mobile: +49 179 2190118


_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

--

vincenz braun
evelox Consulting GmbH & Co. KG

email:  [EMAIL PROTECTED]
phone: +49 700 VINCEBRAUN
mobile: +49 179 2190118


_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to