Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] A strange error (ExceptionInInitializerError)

Hi,

I have a project consisting of the following files:

InvariantEnforcementApplier.aj
public aspect InvariantEnforcementApplier extends Enforcer {
}

Enforcer.aj:
public abstract aspect Enforcer {
    after(): !cflow(within(Enforcer)) && execution(public *.new(..)) {
    }
}

Test.java:
public class Test {
//    Test() {
//    }
    public static final void main(String[] args) {
        Test r1 = new Test();
    }
}

Executing Test.main results in:
Exception in thread "main" java.lang.ExceptionInInitializerError
    at Test.<init>(Test.java:1)
    at Test.main(Test.java:4)
Caused by: java.lang.NullPointerException
    at Enforcer.<clinit>(Enforcer.aj:1)
    ... 2 more

Removing the comments from Test's constructor, the exception is not longer thrown. This looks a lot like a compiler bug.

Thanks a lot for your help,

Manuel
begin:vcard
fn:Manuel Menezes de Sequeira
n:Menezes de Sequeira;Manuel
org:ISCTE;CI
adr;quoted-printable:;;Av. das For=C3=A7as Armadas;Lisboa;;1649-026;Portugal
email;internet:Manuel.Sequeira@xxxxxxxx
title;quoted-printable:Director de Servi=C3=A7os
tel;work:+351 217903085
tel;fax:+351 217903927
tel;cell:+351 962337428
x-mozilla-html:TRUE
url:http://ci.iscte.pt/
version:2.1
end:vcard

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Back to the top