Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Help with calls to external packages


Jesse,

>Can anyone explain either what I'm doing wrong, or why this doesn't work?
What do you mean? Does the pointcut not match? You need to annotate your target class(es):

public class Test {

        @myAnnotation
        public static int aspectTest(int i) {
                return i;
        }
       
        public static void main (String[] args) {
                aspectTest(args.length);
        }
}

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM United Kingdom Limited
Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)



Jesse Hepburn <jesse_hepburn@xxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

28/03/2007 22:49

Please respond to
aspectj-users@xxxxxxxxxxx

To
aspectj-users@xxxxxxxxxxx
cc
Subject
[aspectj-users] Help with calls to external packages





I'm trying to define a pointcut that intercepts calls from outside of the current package.  I've managed to get it to work as follows:

   pointcut myTest(int x):
       call(int *.aspectTest(int))
       && args(x);

   before(int x): myTest(x) {
       System.out.println("Some inspiring message");
   }

The problem is when I try to add an annotation to the mix:

   pointcut myTest(int x, myAnnotation a):
       call(int *.aspectTest(int))
       && args(x)
       && @annotation(a);

   before(int x, myAnnotation a): myTest(x, a) {
       System.out.println("this doesn't work");
   }

Can anyone explain either what I'm doing wrong, or why this doesn't work?







____________________________________________________________________________________
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users







Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU







Back to the top