Community
Participate
Working Groups
Build Identifier: java.lang.NullPointerException at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.doDeclareAnnotations(AjLookupEnvironment.java:915) at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:644) at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:559) at org.aspectj.ajdt.internal.compiler.lookup.AjLookupE ... AutoBuildJob.run(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: NullPointerException thrown: null Reproducible: Sometimes Steps to Reproduce: 1. Create a new Aspect 2. I added this in the aspect: declare @type:VideoEventMessagePreProcessor:@ManagedResource; 3. I pressed CTRL-S to save the file and a message box with the exception popped up.
Forgot to mention, I use STS 2.2.1.200910210131-RELEASE. Don't know if that includes the latest AJDT version? Or how to upgrade if it does not?
Found how to upgrade. Upgraded to 2.3.0.RELEASE of STS, but issue is still appearing. Most annoying as I don't have any gutter markers visible in my aspect as a result (and I really need them to make sure my pointcuts are ok :))
This is an AspectJ compiler problem.
Please use the latest AJDT update site to install the latest AJDT (which includes the AspectJ 1.6.7 release candidate). The update site for AJDT is: http://download.eclipse.org/tools/ajdt/35/update either add that if it isn't defined in your STS, or try and update from it. Once you are on the latest AJDT, can you try and recreate? If the problem happens it should then at least give me a valid line number since line 915 is a comment line in the latest builds right now.
Seems I did not add the update site correctly, this is what I get in the about box now: Eclipse AspectJ Development Tools Version: 2.0.1.e35x-20091001-1600 AspectJ version: 1.6.6.20090930185500 And still the NPE at line 915.
Got it working by using this update site: http://download.eclipse.org/tools/ajdt/35/dev/update About box shows: Eclipse AspectJ Development Tools Version: 2.0.2.e35x-20091229-1000 AspectJ version: 1.6.7.20091214160800 This is new stack trace: java.lang.NullPointerException at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.doDeclareAnnotations(AjLookupEnvironment.java:941) at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:656) at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:569) at org.aspectj.ajdt.internal.compiler.lookup.AjLookupE ... AutoBuildJob.run(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: NullPointerException thrown: null I reproduced it just exactly as before. Create a simple java class. Then create an aspect and try to declare the @ManagedResource annotation on it (make sure you have spring in your classpath). Also note that Eclipse will not provide the correct import statement if you try to auto-complete the @ManagedResource with CTRL+Space (but maybe that is normaly in Eclipse? I use IntelliJ normally)
recreated and fixed. It happens on an incremental build when the annotation specified in the declare cannot be resolved (eg. when the import statement hasn't been added). the crash prevents the nice simple message about the type not being resolved