Bug 70524 - NPE when compiling method that has missing return type
Summary: NPE when compiling method that has missing return type
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: 1.1.11   Edit
Hardware: PC Windows XP
: P3 trivial (vote)
Target Milestone: ---   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-21 06:48 EDT by Luzius Meisser CLA
Modified: 2004-07-27 03:15 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luzius Meisser CLA 2004-07-21 06:48:52 EDT
When compiling a class like

public class X {
	private test(){}
}

the following NPE gets thrown:

java.lang.NullPointerException
	at org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder.visit
(AsmHierarchyBuilder.java:326)
	at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse
(MethodDeclaration.java:144)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse
(TypeDeclaration.java:1034)
	at 
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse
(CompilationUnitDeclaration.java:305)
	at 
org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder.internalBuild
(AsmHierarchyBuilder.java:122)
	at org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder.build
(AsmHierarchyBuilder.java:46)
	at 
org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.finishedCompilationUni
t(EclipseFactory.java:308)
	at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterProcessing
(AjCompilerAdapter.java:134)
	at org.eclipse.jdt.internal.compiler.Compiler.compile
(Compiler.java:372)
	at 
org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation
(AjBuildManager.java:717)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild
(AjBuildManager.java:170)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild
(AjBuildManager.java:100)
	at org.aspectj.ajde.internal.CompilerAdapter.compile
(CompilerAdapter.java:108)
	at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run
(AspectJBuildManager.java:169)


I guess a simple null check will fix this bug.
Comment 1 Mik Kersten CLA 2004-07-21 12:49:43 EDT
Luzius: as you indicate this fix will be straight forward.  But for any bug of 
this sort we should make sure to add at lease a unit test.  I'll fix this in 
my round of ASM updates and am reassigning to me.
Comment 2 Andrew Clement CLA 2004-07-21 12:58:49 EDT
I've just fixed this in my branch of AspectJ on which 1.1.11 is based.  It was
due to the new support we have in 1.1.11 that gets the icons right for intertype
declarations (i.e. which are public/private/etc).  I will, when this book dies
down, integrate my changes back into the AJ base (with tests).
Comment 3 Mik Kersten CLA 2004-07-21 13:13:32 EDT
OK, assigning back to you then.  I didn't realize that AspectJ had been 
branched--how many changes are there in that branch?  This worries me since 
I'm making some ASM updates, including to the class affected by this report, 
and want to avoid merge problems.
Comment 4 Andrew Clement CLA 2004-07-27 03:15:28 EDT
fixed in ajde - merges back into aspectj due soon.