[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-users] A strange NullPointerException
|
This is caused because the cflow stack operation executes before the aspect
instance field is initialized. If you changed to !cflow(within(Enforcer+) &&
adviceexecution()) it should work. You could probably even use
!staticinitialization(*), although in general it's desirable to limit cflow
tests to a given kind of join point and not capture all join points within a
type...
-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Manuel Menezes de
Sequeira
Sent: Wednesday, June 06, 2007 1:17 PM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] A strange NullPointerException
Hi all,
I ran into a problem which may be a compiler bug. The code below should
reproduce the error. If class EnforcementApplier is removed and Enforcer
is made concrete, no error occurs. If !cflow(within(Enforcer+)) is
removed from the advice definition, again no error occurs. Any help
would be appreciated.
Thanks a lot,
Manuel
A.java:
package tests;
public class A {
void foo() {}
public static void main(String[] args) {
A a = new A();
a.foo(); // line 8
}
}
Enforcer.aj:
package tests;
public abstract aspect Enforcer {
before(): !cflow(within(Enforcer+)) && execution(!static * *(..)) {
}
}
EnforcementApplier.aj:
package tests;
import tests.Enforcer;
public aspect EnforcementApplier extends Enforcer {
}
Using "Eclipse SDK Version: 3.2.2 Build id: M20070212-1330" and "Eclipse
AspectJ Development Tools Version: 1.4.0 Build id: 20060629124300
AspectJ version: 1.5.2", the result is:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/aspectj/lang/NoAspectBoundException
at tests.A.foo(A.java)
at tests.A.main(A.java:8)
Using "Eclipse SDK Version: 3.3.0 Build id: I20070323-1616" and "Eclipse
AspectJ Development Tools xVersion: 1.5.0.200703300605 AspectJ version:
1.5.4.200701151324", the result is:
Exception in thread "main" java.lang.ExceptionInInitializerError
at tests.A.foo(A.java:4)
at tests.A.main(A.java:8)
Caused by: java.lang.NullPointerException
at tests.Enforcer.<clinit>(Enforcer.aj:1)
... 2 more
The result was the same after updating AJDT to "Eclipse AspectJ
Development Tools Version: 1.5.0.200705301038 AspectJ version:
1.5.4.200705211336"
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users