Skip to main content

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

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


Back to the top