Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: annotated itd method not advised

When I change my aspect like this as you suggest:

package com.oni.tbdb.test.aspectj;

public aspect WrapItd {

	public pointcut exec(Wrap w) :
		execution(@Wrap * *..*(..))
		&& @annotation(w)
		;//&& within(@ItdFilter *..*);

	declare parents : ((@ItdFilter *..*) && !Itd)
		implements Itd;

	public void Itd.method() {
		System.out.println("in method");
	}

	void around(Wrap w) : exec(w) {
		System.out.println("around before");
		proceed(w);
		System.out.println("around after");
	}

	@Wrap
	public void Itd.method2() {
		System.out.println("in method2");
	}

	@Wrap
	public void TestClass.method3() {
		System.out.println("in method3");
	}
}

I took out the within() for the pointcut, and it dod not advize.  I
then added the last itd directly to the test class and I get an error
when it compiles:

java.lang.ClassCastException
at org.aspectj.weaver.bcel.BcelShadow.getAnnotations(BcelShadow.java:1597)
at org.aspectj.weaver.bcel.BcelShadow.initializeKindedAnnotationVars(BcelShadow.java:1675)
at org.aspectj.weaver.bcel.BcelShadow.getKindedAnnotationVar(BcelShadow.java:1128)
at org.aspectj.weaver.patterns.AnnotationPointcut.findResidueInternal(AnnotationPointcut.java:195)
at org.aspectj.weaver.patterns.Pointcut.findResidue(Pointcut.ja ...
db/test/aspectj/WrapItd;
                    RETURN
  end private static void ajc$postClinit()
end public class com.oni.tbdb.test.aspectj.WrapItd

It seems like I can not apply advice to introduced methods?

Mike


Back to the top