Bug 298504 - [plan] NPE at AjLookupEnvironment.java:915
Summary: [plan] NPE at AjLookupEnvironment.java:915
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 1.6.9M1   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-24 07:54 EST by Wim Deblauwe CLA
Modified: 2010-04-16 13:10 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wim Deblauwe CLA 2009-12-24 07:54:30 EST
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.
Comment 1 Wim Deblauwe CLA 2009-12-24 07:55:44 EST
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?
Comment 2 Wim Deblauwe CLA 2009-12-24 08:53:33 EST
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 :))
Comment 3 Andrew Eisenberg CLA 2009-12-24 10:42:36 EST
This is an AspectJ compiler problem.
Comment 4 Andrew Clement CLA 2009-12-30 13:08:27 EST
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.
Comment 5 Wim Deblauwe CLA 2009-12-30 15:31:53 EST
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.
Comment 6 Wim Deblauwe CLA 2009-12-30 15:44:07 EST
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)
Comment 7 Andrew Clement CLA 2010-03-15 17:04:54 EDT
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