Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] @DeclareParents disallowed

Andy, Alex,

Thank you for your help.

Yes it has.  Check the developer notebook included with the aspectj
distribution, the version on the AJ website hasnt been updated yet. Here is a snippet relevant to what you are doing:

Now with code below, the aspect detects "407 AspectJ markers at this line"!

Good but ... the after advice is never executed.

With a simple after advice, without declare parents statement, everything is ok.

Any idea?

Pierre





===========================
package com.uwyn.ecalendar.aop;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.DeclareParents;

@Aspect
public class TestAop3 {
   @DeclareParents("com.uwyn.rife.engine.ElementSupport+")
   public static Moody introduced = new MoodyImpl();

@After("execution(public static String com.uwyn.rife.config.RifeConfig.Tools.getDefaultLanguage()) && this(m)")
   public void feelingMoody(Moody m) {
System.out.println("[TestAop3.feelingMoody] after RifeConfig.Tools.getDefaultLanguage: " + m.getMood());
   }

}

===========================
package com.uwyn.ecalendar.aop;

public interface Moody {
   String getMood();
};

===========================
package com.uwyn.ecalendar.aop;

public class MoodyImpl implements Moody {
   private String mood = "Mood.HAPPY";

   public String getMood() {
     return this.mood;
   }
}






Back to the top