Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] avoid locked method invocation with an annotation

Hi all,
as by subject I'd like to annotate some methods with a @Lock annotation and 
I'd like to have an aspect avoiding the invocation of such methods, so I have 
done the following:

    private pointcut avoidLockedMethodInvocation( AgentProxy proxy ) : 
       call( public AgentProxy+.*(..) )  && 	@annotation(Lock) 	
           && target( proxy );
    
    
    before( AgentProxy proxy ) : avoidLockedMethodInvocation( proxy ){
	
	if( isAgentProxyLocked( proxy ) )
	    throw new Exception();
	else
	    proceed( proxy );
    }


But it gives me a "formal unbound" error on the proxy parameter. Moreover I'm 
in doubt if it is correct to use the annotation pointcut in such a way. What I 
want to avoid is that a method like the following is invoked:

public class myproxy extends AgentProxy{
    @Lock()
   public void method(){}
}

Anybody can give me some hint?

Thanks,
Luca


Back to the top