Bug 296054 - The following broken code is raising an exception in the compiler
Summary: The following broken code is raising an exception in the compiler
Status: CLOSED DUPLICATE of bug 293457
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 minor (vote)
Target Milestone: 1.6.7   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-24 15:38 EST by Andrew Eisenberg CLA
Modified: 2009-11-26 18:29 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Eisenberg CLA 2009-11-24 15:38:28 EST
While working on bug 296044, I found that the compiler was throwing an excepiton under this code:

in default package AnnotAspect.aj:

@SuppressWarnings("nls")
public aspect AnnotAspect {
    declare @field : * AnnotDemo.* : @Demo(myValues={"alfa", "beta", "gamma"});
    
}
class AnnotDemo {
//  that works fine in the java class 
//@Demo(myValues={"alfa", "beta", "gamma"})
private int annotateMe;
}  

in default package Demo.java:

public @interface Demo {
    Class[] myValues() default { };
}

Note that the declare declaration uses strings and the @interface requires classes.


Exception is this:
java.lang.NullPointerException
at org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder.visit(AsmHierarchyBuilder.java:548)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:214)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1246)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUni ... AutoBuildJob.run(AutoBuildJob.java:238)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Compile error: NullPointerException thrown: null
Comment 1 Andrew Clement CLA 2009-11-24 16:01:35 EST
likely dup of bug 293457 which is already fixed.  Will add a testcase for this to confirm.
Comment 2 Andrew Clement CLA 2009-11-26 18:29:57 EST
added a regression test based on the code here, passes fine, i really think it is the same problem that I fixed under the other bug.

*** This bug has been marked as a duplicate of bug 293457 ***