Bug 162539 - NullPointerException when pointcut library missing @aspect annotion
Summary: NullPointerException when pointcut library missing @aspect annotion
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.4   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-27 05:33 EDT by Matthew Webster CLA
Modified: 2007-11-19 11:38 EST (History)
1 user (show)

See Also:


Attachments
Testcase (4.46 KB, patch)
2006-10-27 06:08 EDT, Matthew Webster CLA
no flags Details | Diff
mylyn/context/zip (2.09 KB, application/octet-stream)
2007-11-19 11:36 EST, Andrew Clement CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Webster CLA 2006-10-27 05:33:32 EDT
If you omit the @aspect annotation when using @pointcut you get a nice error but not if it's a pointcut library referenced from another aspect:

java.lang.NullPointerException
at org.aspectj.weaver.patterns.ReferencePointcut.concretize1(ReferencePointcut.java:361)
at org.aspectj.weaver.patterns.Pointcut.concretize(Pointcut.java:233)
at org.aspectj.weaver.patterns.Pointcut.concretize(Pointcut.java:220)
at org.aspectj.weaver.Advice.concretize(Advice.java:353)
at org.aspectj.weaver.bcel.BcelAdvice.concretize(BcelAdvice.java:86)
at org.aspectj.weaver.CrosscuttingMembers.addShadowMu ... pter.java:107)
at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)

NullPointerException thrown: null
Comment 1 Matthew Webster CLA 2006-10-27 06:08:13 EDT
Created attachment 52829 [details]
Testcase

The NPE only seems to occur with the older version of AspectJ 1.5.3-200608290814 that I have installed with AJDT. This testcase just yields:

	warning at C:\temp\ajcSandbox\org.aspectj-159854\ajcTest11388.tmp\test\ataspectj\pointcutlibrary\AtAspect.java:15::0 advice defined in test.ataspectj.pointcutlibrary.AtAspect has not been applied [Xlint:adviceDidNotMatch]
Comment 2 Helen Beeken CLA 2006-10-27 06:20:37 EDT
Is this anything to do with bug 158412 which was fixed on the 25th September?
Comment 3 Matthew Webster CLA 2006-10-30 10:14:18 EST
It does seem the same. Now if you omit the @aspect annotation the pointcut _sometime_ does not match. I think we should issue an error message.
Comment 4 Andrew Clement CLA 2007-10-25 08:25:40 EDT
check this for 1.5.4 - is there still something to address here?
Comment 5 Andrew Clement CLA 2007-11-09 11:49:08 EST
although the npe is gone, there is a still a problem here where we fail to correctly resolve @AspectJ pointcuts - if they don't get resolved then they fail to match.  If they come in from a class in a .jar that is OK, the problem is when they are compiled all from source and exist as pointcuts in a regular class.  I have had to change resolution quite a bit to allow for this but I seem to almost have a solution ready to commit.
Comment 6 Andrew Clement CLA 2007-11-19 11:36:00 EST
Fixes committed for this.  I modified the resolution process for @AJ pointcuts to correctly build LazyResolvedPointcutDefinitions.  Also I changed a lot of the code that searches for @AspectJ annotations - that should be much faster now.
Comment 7 Andrew Clement CLA 2007-11-19 11:36:50 EST
Created attachment 83250 [details]
mylyn/context/zip
Comment 8 Andrew Clement CLA 2007-11-19 11:38:22 EST
fix will be in next dev build