Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324190

Summary: NullPointerException in AjBuildManager.findOutputDirsForAspects when compiling AspectJ project generated with Maven
Product: [Tools] AspectJ Reporter: Gaël Renoux <gael.renoux>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aclement, dpalomar
Version: DEVELOPMENT   
Target Milestone: 1.6.10   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
pom.xml used to generate the project
none
.project
none
.classpath none

Description Gaël Renoux CLA 2010-09-01 09:15:48 EDT
Build Identifier: 20100617-1415

When I compile my AspectJ project, I get an AspectJ Internal Compiler Error. The stack trace is : 
java.lang.NullPointerException
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.findOutputDirsForAspects(AjBuildManager.java:725)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.writeOutxmlFile(AjBuildManager.java:652)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:367)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:181)
at org.aspectj.a ... on$1.run(GlobalBuildAction.java:179)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

I digged a bit and looked into the classes. It would seem that AjState.getAspectNamesToFileNameMap() can return null in AjBuildManager.findOutputDirsForAspects. It is taken in account when AjBuildConfig.getCompilationResultDestinationManager() returns null or a list with one element, but not when it returns a list with several elements.

Reproducible: Always

Steps to Reproduce:
Always happen in my configuration, but I didn't try to make it happen again in another workspace. Here are the steps I followed.

1. Generate a AspectJ project with Maven using the pom.xml I'll join
2. Create an aspect with a few pointcuts and a few advices
3. Compile (not with maven, the Eclipse compilation)
Comment 1 Gaël Renoux CLA 2010-09-01 09:17:33 EDT
Created attachment 177948 [details]
pom.xml used to generate the project
Comment 2 Gaël Renoux CLA 2010-09-01 09:19:40 EDT
Created attachment 177949 [details]
.project
Comment 3 Gaël Renoux CLA 2010-09-01 09:19:53 EDT
Created attachment 177950 [details]
.classpath
Comment 4 Andrew Clement CLA 2010-09-01 11:02:48 EDT
null guard added.
Comment 5 Andrew Clement CLA 2011-01-21 11:47:14 EST
*** Bug 331981 has been marked as a duplicate of this bug. ***