Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: [NEWSDELIVER] Determining if method returned null or has return type void ini after() returning(Object o).



Adam,

Try adding the following pointcut to your definition of
"goodCitizenMethod()" which will exclude all methods that return "void":

            && execution(!void *(..));

You might like to use the aspectj-users mailing list for this type of
question.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

Adam Kruszewski <spambox@xxxxxxxxxxxxxxx> on 25/01/2005 09:33:17

To:
cc:
Subject:    [NEWSDELIVER] Determining if method returned null or has return
       type void ini after() returning(Object o).



I have a simple after() returning advice:

after () returning(Object retValue) : goodCitizenMethod() {
             Signature sig = thisJoinPoint.getSignature();
         System.out.println("Sig:"+sig);
             System.out.println("returning:"+retValue);
             }

I want to check if goodCitizenMehod (any method annotated with
@GoodCitizen ;-)) returned null, but that way any method with void
return type is always a 'badCitizen'.

Is there an easy way to determine if returned value is actually null or
specified method return type is void ?


Regards,
   a.






Back to the top