Bug 91858

Summary: NullPointerException when declare @type is spelt with capital letter
Product: [Tools] AspectJ Reporter: Sian January <sjanuary>
Component: CompilerAssignee: Adrian Colyer <adrian.colyer>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.5.0M3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Sian January CLA 2005-04-19 05:38:48 EDT
I have the following code in an AspectJ project:

declare @Type: MainClass : @MyAnnotation;

I believe the correct syntax should be:

declare @type: MainClass : @MyAnnotation;

However when I saved my aspect with the first version I got the following 
NullPointerException:

java.lang.NullPointerException
	at 
org.aspectj.ajdt.internal.compiler.ast.DeclareAnnotationDeclaration.postParse
(DeclareAnnotationDeclaration.java:83)
	at 
org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope.postParse
(ClassScope.java:175)
	at 
org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope.buildFieldsAndM
ethods(ClassScope.java:154)
	at 
org.aspectj.org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.build
FieldsAndMethods(CompilationUnitScope.java:63)
	at 
org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.completeTypeBindi
ngs(AjLookupEnvironment.java:104)
	at 
org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.beginToCompile
(Compiler.java:331)
	at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile
(Compiler.java:348)
	at 
org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation
(AjBuildManager.java:683)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild
(AjBuildManager.java:191)
	at 
org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild
(AjBuildManager.java:109)
	at org.aspectj.ajde.internal.CompilerAdapter.compile
(CompilerAdapter.java:117)
	at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run
(AspectJBuildManager.java:165)
Comment 1 Andrew J Huff CLA 2005-04-19 08:59:33 EDT
actually it's not just if you spell it Type, the following code produces the bug
for any XXX other than a recognised one (type):

@interface myInterface {}
aspect A{
  declare @XXX: A : @myInterface;
}
Comment 2 Adrian Colyer CLA 2005-04-20 09:01:16 EDT
patch submitted by Andrew Huff (IBM). Bug will be closed when available in a
published build.
Comment 3 Adrian Colyer CLA 2005-08-26 11:19:37 EDT
forgot to close this out, fix was available a good while ago...