Skip to main content

[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,

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"



Back to the top