Bug 254837

Summary: [annotations] NullPointerException at org.aspectj.ajdt.internal.compiler.lookup.EclipseResolvedMember.getEclipseAnnotations:219
Product: [Tools] AspectJ Reporter: Christoph Pickl <e0525580>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: NEW --- QA Contact:
Severity: minor    
Priority: P3 CC: aclement
Version: 1.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Christoph Pickl CLA 2008-11-11 03:39:49 EST
Build ID: I20080617-2000

Steps To Reproduce:
just follow Invan A Krizsan's Contract4j guide:
http://aspectprogramming.com/papers/Getting_Started_with_Contract4J.pdf

1. download contract4j5 0.80
2. unzip it
3. create a new aspectj project in eclipse
4. set path to "../Contract4J5_V080/contract4j5"
5. hit finish

More information:
java.lang.NullPointerException
at org.aspectj.ajdt.internal.compiler.lookup.EclipseResolvedMember.getEclipseAnnotations(EclipseResolvedMember.java:219)
at org.aspectj.ajdt.internal.compiler.lookup.EclipseResolvedMember.getAnnotationTypes(EclipseResolvedMember.java:165)
at org.aspectj.ajdt.internal.compiler.lookup.EclipseResolvedMember.hasAnnotation(EclipseResolvedMember.java:77)
at org.aspectj.weaver.JoinPointSignature.hasAnnotation(Join ... stInvokeTestFailsWithFalseBooleanTestExpression()

end public class org.contract4j5.interpreter.bsf.test.BSFExpressionInterpreterAdapterSimpleTest

=====================

java.lang.NullPointerException
at org.aspectj.ajdt.internal.compiler.lookup.EclipseResolvedMember.getEclipseAnnotations(EclipseResolvedMember.java:219)
at org.aspectj.ajdt.internal.compiler.lookup.EclipseResolvedMember.getAnnotationTypes(EclipseResolvedMember.java:165)
at org.aspectj.ajdt.internal.compiler.lookup.EclipseResolvedMember.hasAnnotation(EclipseResolvedMember.java:77)
at org.aspectj.weaver.JoinPointSignature.hasAnnotation(Join ... stInvokeTestFailsWithFalseBooleanTestExpression()

end public class org.contract4j5.interpreter.bsf.test.BSFExpressionInterpreterAdapterSimpleTest

=====================

java.lang.NullPointerException
at org.aspectj.ajdt.internal.compiler.lookup.EclipseResolvedMember.getEclipseAnnotations(EclipseResolvedMember.java:219)
at org.aspectj.ajdt.internal.compiler.lookup.EclipseResolvedMember.getAnnotationTypes(EclipseResolvedMember.java:165)
at org.aspectj.ajdt.internal.compiler.lookup.EclipseResolvedMember.hasAnnotation(EclipseResolvedMember.java:77)
at org.aspectj.weaver.JoinPointSignature.hasAnnotation(Join ... stInvokeTestFailsWithFalseBooleanTestExpression()

end public class org.contract4j5.interpreter.bsf.test.BSFExpressionInterpreterAdapterSimpleTest
Comment 1 Andrew Clement CLA 2008-12-01 13:54:41 EST
I've just tried recreating this but it is working fine for me.  I am on the latest AJDT for Eclipse 3.4.

Are you sure there isn't something you did after step 5?  From the look of the failure it appears to occur when weaving code that is broken (has a syntax error or something like that).  I've tried a project clean and making minor breaking changes here and there in the project but it always just works.

However, as a precaution I've put a guard in at the line which has the problem, to cope with null. 
Comment 2 Christoph Pickl CLA 2008-12-22 07:12:45 EST
okay, gave it another try -with the latest eclipse and ajdt plugin version (contract4j is still 4.8)- but again without success...

> Are you sure there isn't something you did after step 5?

yes, i am sure.
created a new aspectj project, entered arbitrary text for project name, selected "Create project from existing source" and pointed it to the source folder of contract4j. after hitting finish i am getting the same exception(s).

never the less i am able to use the project correctly after creation, therefore changed severity form normal to minor -hope thats okay for you andy.
Comment 3 Andrew Clement CLA 2009-01-30 20:37:08 EST
I'm trying again to recreate this, but it absolutely will not happen for me and always compiles clean.

If you get a chance, can you confirm the AJDT version you most recently saw this on?  The code that was NPEing has so many guards in now, i don't see how it can be going wrong...