[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Load Time Weaving Bug ?
|
Hi,
I've encountered a rather strange problem using the loadtime weaving
functionality which causes the following error message:
Test\aspect1.java: error class 'Test.aspect1$myweak' is already woven and has no
t been built with -Xreweavable
trouble in:
Exception in thread "main" Message: error at Test\aspect1.java class 'Test.aspec
t1$myweak' is already woven and has not been built with -Xreweavable
org.aspectj.bridge.AbortException: class 'Test.aspect1$myweak' is already woven
and has not been built with -Xreweavable
at org.aspectj.weaver.tools.WeavingAdaptor$MessageHandler.handleMessage(
WeavingAdaptor.java:266)
at org.aspectj.weaver.World.showMessage(World.java:258)
...
The example code which I used to generate this is:
-- FILE aspect1.java --
package Test;
aspect aspect1 {
after() returning(Object newObject)
: call(*.new(..)) && !within(Test..*) { new myweak(); }
private class myweak {
public int tmp() { return 1; }}
}
-- FILE aspect2.java --
package Test;
aspect aspect2 pertarget(allUses()) {
pointcut allUses() : (call(* *.*(..))) && !within(Test..*);
before() : allUses() { System.out.println("ASPECT 2 : BEFORE!"); }
}
-- FILE test.java --
class test {
int data;
public void fn() { System.out.println("FN CALLED!"); }
public static void main(String argv[]) {
test t = new test();
t.fn();
}
}
It seems the problem arises from using a nested class within an aspect
(class myweak in the example). A few points, I compiled and run the
code using this:
c> javac test.java
c> ajc aspect1.java aspect2.java -outjar asp.jar
c> set ASPECTPATH=asp.jar
c> aj test
A few interesting points. Removing the perthis declarations also gets
rid of the problem? Also, if the classes are statically woven like so:
c> ajc test.java aspect1.java aspect2.java
then there is no problem. So, any help/opinion regarding this and
whether it is actually a bug or not would be appreciated!
Thanks,
David J. Pearce