Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] context with and without annotations

This pointcut match : (value of type Object)

             pointcut myMethodInvocation(String key,Object value) :
                         call(public void MyOtherClass.myMethod(..)) &&
                         args(key,value);

This one doesn't match : (value of type MyAnnotation)

             pointcut myMethodInvocation(String key,MyAnnotation value) :
                         call(public void MyOtherClass.myMethod(..)) &&
                         args(key,value);

-----Message d'origine-----
De : aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx]De la part de Andrew Clement
Envoyé : vendredi 8 avril 2005 10:13
À : aspectj-users@xxxxxxxxxxx
Objet : Re: [aspectj-users] context with and without annotations






@args() is for extracting annotations on annotated things, here you just
want to access an annotation type being used as a regular parameter.  Does
it not work like this?

             pointcut myMethodInvocation(String key,MyAnnotation value) :
                         call(public void MyOtherClass.myMethod(..)) &&
                         args(key,value);

Although there should not be a verifyerror and that is a compiler bug...
want to raise it?

Andy.



                                                                           
             Rifflard Mickaël                                              
             <Mickael.Rifflard                                             
             @atosorigin.com>                                           To 
             Sent by:                  <aspectj-users@xxxxxxxxxxx>         
             aspectj-users-bou                                          cc 
             nces@xxxxxxxxxxx                                              
                                                                   Subject 
                                       [aspectj-users] context with and    
             08/04/2005 09:07          without annotations                 
                                                                           
                                                                           
             Please respond to                                             
             aspectj-users@ecl                                             
                 ipse.org                                                  
                                                                           
                                                                           




Hi all,

I want to expose arguments of a method.
The first argument is a String argument.
The second one is an annotation.

Exemple :

             @Target(ElementType.TYPE)
             @Retention(RetentionPolicy.RUNTIME)
             public @interface MyAnnotation { ... }

             @MyAnnotation
             public class MyClass { ... }

             public class MyOtherClass {
                         public void myMethod(String arg1,MyAnnotation
arg2) {...}

                         public static void main(String[] args) {
                                     ...
                                     MyClass mc = new MyClass();
                                     MyOtherClass moc = new MyOtherClass();
                                     moc.myMethod("sample",moc);
                                     ...
                         }
             }

I want to expose "sample" and moc arguments as pointcut context.

I tested this pointcut :

             pointcut myMethodInvocation(String key,MyAnnotation value) :
                         call(public void MyOtherClass.myMethod(..)) &&
                         args(key,*) && @args(*,value);

With this pointcut, I receive a java.lang.VerifyError : Unable to pop
operand off an empty stack

Is there another solution ?

Regards,

Mickaël RIFFLARD
Atos Origin
_______________________________________________
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


Back to the top