Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Abstract aspect and !cflow(within) results in ExceptionInInitializerError

Hello,

with the program given below, I get the exception:

Exception in thread "main" java.lang.ExceptionInInitializerError
        at test1.Test.sayHello(Test.java:7)
        at test1.Test.main(Test.java:13)
Caused by: java.lang.NullPointerException
        at test1.Aspect.<clinit>(Aspect.aj:1)
        ... 2 more

Making "Aspect" concrete and removing "ExtendedAspect" makes everything work
fine. 
This appears to be a bug in ajc. Do you agree?

Thanks,

Benjamin


---test1/Test.java---
package test1;

public class Test
{
        public void sayHello()
        {
                System.out.println("hello World");
        }
        
        public static void main(String[] args)
        {
                Test hw = new Test();
                hw.sayHello();
        }
}

---test1/Aspect.aj---
package test1;

abstract privileged aspect Aspect
{
        before(Test self) : execution(* Test.sayHello()) 
                && this(self) && !cflow(within(Aspect))
        {
                System.out.println("before:sayHello");
                self.sayHello();
        }
}

---test1/ExtendedAspect.aj---
package test1;

public aspect ExtendedAspect extends Aspect
{
}



Back to the top