Bug 324804

Summary: NullPointerException at AspectJElementHierarchy.java:677
Product: [Tools] AspectJ Reporter: Jesse Englert <jenglert>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aclement
Version: unspecified   
Target Milestone: 1.6.10   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
JVM Error Log none

Description Jesse Englert CLA 2010-09-08 18:30:31 EDT
Build Identifier: 20100617-1415

After removing a "throws" clause from the constructor of a class and then saving I got the following error:

java.lang.NullPointerException
at org.aspectj.asm.internal.AspectJElementHierarchy.getCanonicalFilePath(AspectJElementHierarchy.java:677)
at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:641)
at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:572)
at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:604)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager ... oBuildJob.run(AutoBuildJob.java:242)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Compile error: NullPointerException thrown: null

Reproducible: Didn't try
Comment 1 Jesse Englert CLA 2010-09-08 18:41:43 EDT
Created attachment 178463 [details]
JVM Error Log

I was able to reproduce this error when adding or removing the throws clause from the constructor...until Eclipse eventually crashed. Attaching the JVM hs_err log. The JVM identified the following: 

# Problematic frame:
# J  org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(Ljava/util/Set;)V
Comment 2 Andrew Clement CLA 2010-09-09 12:24:56 EDT
Possibly a threading issue with an AJDT thread affecting the handleMap which the compiler is in the middle of processing.  A guard would seem to suffice here as null effectively means the same as the check the code was going to perform.

Not sure why a simple NPE would lead to a vm crash.

I've committed a guard on null to stop this occurring.