[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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,



   package tests;

public class A {
void foo() {}
public static void main(String[] args) {
A a = new A();
a.foo(); // line 8


   package tests;

   public abstract aspect Enforcer {
       before(): !cflow(within(Enforcer+)) && execution(!static * *(..)) {


   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:
       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: AspectJ version:", 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: AspectJ version:"