Are you sure you can use proceed method with a before advice? I think you
can use it only with around advice.


Cordialement / Best regards

Jean-Louis Pasturel



-----Message d'origine-----
De : aspectj-users-boun...@eclipse.org
[mailto:aspectj-users-boun...@eclipse.org] De la part de Luca Ferrari
Envoyé : lundi 15 février 2010 08:36
À : aspectj-users@eclipse.org
Objet : [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
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users



*********************************
This message and any attachments (the "message") are confidential and intended 
solely for the addressees. 
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration. 
France Telecom Group shall not be liable for the message if altered, changed or 
falsified.
If you are not the intended addressee of this message, please cancel it 
immediately and inform the sender.
********************************

_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to