I tried to do exactly the same aspect using "code style" and it worked perfectly. But in the doc I found this: "Whichever style you use, the AspectJ weaver ensures that your program has exactly the same semantics."
I think this is not true! "this" returns different instances in the different styles. Is this a bug in the annotation style or is this intended?!?!? I really like the annotation style with the LTW (very flexible and dynamic, can even compile in Continuum without ajc etc......), but for now it is unusable to me :-(( Please help! Thanks On Wed, 2007-03-28 at 14:50 +0200, Roland Reckel wrote: > Hi > > I have a problem with the @DeclareParents annotation: > this.getClass() returns the implementation class of the Aspect and not > the "aspected" class. > > Is this a bug? Or does any other method exist to get the aspected class? > BTW: I use AspectJ 1.5.3 > > Here an example: > > @Aspect > public class PersistenceAspect { > > public interface IPersistentObject { > void store(); > > void delete(); > } > > public static class PersistentObjectImpl implements > IPersistentObject { > > public void store() { > } > > public void delete() { > System.out.println("Class: " + this.getClass()) // Does return > PersistentAspect$PersistentObjectImpl !?!?!?!? > } > } > > @DeclareParents(value = "@lu.vdl.trasal.annotation.PersistentObject > *", defaultImpl = PersistentObjectImpl.class) > private IPersistentObject implementedInterface; > > } > > > Does anybody have the same problem? (I found some mails with the same > problem but no answer or bug report :-(( > > Thx for your help > > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users