Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Problems (Misunderstandings) With AspectJ 1.1

I've got the latest version of AspectJ 1.1 and am trying to test out the
byte-code weaving. I've got a pointcut that looks like this

pointcut stat_init(): staticinitialization(A+);

and advice 

before(): stat_init()
{
	System.out.println("StaticInit: " + thisJoinPoint);
}

which works fine for my A class and its subclass, C. But if I change it to
this

pointcut stat_init(): staticinitialization(java.lang.Object+);

to show me all classes as they are loaded, I get varying degrees of
failure, depending on how I run it. If I run from within Eclipse, I get
this

java.lang.ExceptionInInitializerError:
org.aspectj.lang.NoAspectBoundException
	at com.joeygibson.ajt.Showcase.aspectOf(Showcase.java)
	at com.joeygibson.ajt.Showcase.<clinit>(Showcase.java)
	at com.joeygibson.ajt.A.<clinit>(A.java)
Exception in thread "main" 

If I run from within Ant, I get this 

[java] java.lang.NoClassDefFoundError

but changing back to the original pointcut works fine in both environments.
In my Ant build file, I've tried adding injars="c:\jdk1.3\jre\lib\rt.jar"
to the iajc line, and while I do get a much larger output jar, the result
is still the same, a NoClassDefFoundError.

Am I doing something wrong? Can anyone help me out? Admittedly, tracing all
static initializers is not terribly useful, it's just an example to see if
I understand the byte-code weaving stuff.

Thanks,
Joey


--
http://www.joeygibson.com
http://www.joeygibson.com/cgi-bin/blosxom.cgi/life/Wisdom.html



Back to the top