Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Exposing state held in method annotations


I found a problem this morning with annotation resolution if the annotations
are in packages - this may or may not be the problem you are seeing.  I've
just fixed it.  Download the latest dev build to try out the fix.

cheers,
Andy.



Pepe Iborra <pepegg@xxxxxxxxx>
Sent by: aspectj-users-admin@xxxxxxxxxxx

29/01/2005 23:36

Please respond to
aspectj-users@xxxxxxxxxxx

To
aspectj-users@xxxxxxxxxxx
cc
Subject
RE: [aspectj-users] Exposing state held in method annotations





Hi Eric

I've spotted a mistake in my code, it should be:
Method m = c.getMethod(msig.getName(),
msig.getParameterTypes());

Instead of:
Method m = c.getMethod(sig.getName(),
sig.getParameterTypes());

Sorry for that.

The compilation problem you mention is really weird,
I've not run into that. Before calling the bug alarms
however, please check if an import statement does
it(it shouldn't be necessary if they're in the same
package but anyway). If it works then it's probably a
bug, if it doesn't please try to move the type
ConstantArguments to another package and import it. If
it works then it's probably a bug, if it doesn't then
it's probably some kind of problem in your setup.

Good luck

--- Eric Bodden <eric@xxxxxxxxx> escribió:
>  
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hmmm, strange. I tried the following, but apparently
> AspectJ is
> unable to resolve the annotation interface type
> ConstantArguments:
>
>    pointcut constantArgumentMethods() :
>         call(@ConstantArguments * *.*(..));
>    
>     /*pointcut
> constantArgumentMethods(ConstantArguments annot)
>         : call(@ConstantArguments * *.*(..))
>             && @annotation(annot);*/
>    
>     Object around(): constantArgumentMethods() {
>        
>         Signature sig =
>             thisJoinPointStaticPart.getSignature();
>         Class c = sig.getDeclaringType();
>         MethodSignature msig =
>            
>
(MethodSignature)thisJoinPointStaticPart.getSignature();
>         Method m = c.getMethod(sig.getName(),
> msig.getParameterTypes());
>         ConstantArguments = (ConstantArguments)
> m.getAnnotation(ConstantArguments.class);
>
> The last line here gives the error:
>
> ConstantArguments cannot be resolved
> ConstantArgumentsAspect.aj
>
> And that, though the annotation type is located in
> the very same
> package! Yet another bug?
>
> Eric
>
> Pepe Iborra wrote:
> > I've been using the following (ugly) code due to
> lack of binding
> > support in M1:
> >
> > pointcut constantArgumentMethods(int[] value) :
> > call(@ConstantArguments(value) * *.*(..));
> >
> > before(..) : constantArgumentMethods(..) {
> >   Signature sig =
> > thisJoinPointStaticPart.getSignature();
> >   Class c = sig.getDeclaringType();
> >   MethodSignature msig =
> >
>
((MethodSignature)thisJoinPointStaticPart).getSignature();
> >   Method m = c.getMethod(sig.getName(),
> > sig.getParameterTypes());
> >
> >   ConstantArguments = (ConstantArguments)
> > m.getAnnotation(ConstantArguments.class);
> >
> > ---do something with the annotation---
> >
> > }
>
>
> - --
> Eric Bodden
> Chair I2 for Programming Languages and Program
> Analysis
> RWTH Aachen University
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGP 8.0.3
>
>
iQA/AwUBQfuZOMwiFCm7RlWCEQLRuACg24KjRryID3IGi57IhWhIaJoA94UAmwU2
> 2Y4Pbd0RE//tOUDFbeu5QO+m
> =dXKC
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
>
http://dev.eclipse.org/mailman/listinfo/aspectj-users
>  


                                 
______________________________________________
Renovamos el Correo Yahoo!: ¡250 MB GRATIS!
Nuevos servicios, más seguridad
http://correo.yahoo.es
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top