Bug 222987 - More NPEs in Java15AnnotationFinder
Summary: More NPEs in Java15AnnotationFinder
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows Vista
: P2 major (vote)
Target Milestone: 1.6.2   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-17 13:57 EDT by Andrew Clement CLA
Modified: 2008-08-28 12:00 EDT (History)
1 user (show)

See Also:


Attachments
patch class file for weaver (3.18 KB, application/octet-stream)
2008-03-17 14:07 EDT, Andrew Clement CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2008-03-17 13:57:36 EDT
Reported on the list by Chris Wall and on spring bug http://jira.springframework.org/browse/SPR-4390

---
When my plugin is initiated and during Spring context beans loading,
we're getting the following:

Caused by: java.lang.NullPointerException
       at org.aspectj.weaver.reflect.Java15AnnotationFinder.getParameterNamesFromLVT(Java15AnnotationFinder.java:196)
       at org.aspectj.weaver.reflect.Java15AnnotationFinder.getParameterNames(Java15AnnotationFinder.java:187)
       at org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate.tryToDiscoverParameterNames(Java15ReflectionBasedReferenceTypeDelegate.java:297)
       at org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate.getDeclaredPointcuts(Java15ReflectionBasedReferenceTypeDelegate.java:270)
       at org.aspectj.weaver.ReferenceType.getDeclaredPointcuts(ReferenceType.java:535)
       at org.aspectj.weaver.ResolvedType$7.get(ResolvedType.java:477)
       at org.aspectj.weaver.Iterators$3$1.hasNext(Iterators.java:118)
       at org.aspectj.weaver.Iterators$3.hasNext(Iterators.java:128)
       at org.aspectj.weaver.ResolvedType.findPointcut(ResolvedType.java:488)
       at org.aspectj.weaver.patterns.ReferencePointcut.resolveBindings(ReferencePointcut.java:152)
       at org.aspectj.weaver.patterns.Pointcut.resolve(Pointcut.java:196)
       at org.aspectj.weaver.tools.PointcutParser.resolvePointcutExpression(PointcutParser.java:330)
       at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:308)
       at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:197)
       at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:184)
       at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:165)
       at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:198)
       at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:253)
       at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:287)
       at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:113)
       at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:85)
       at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:66)
       at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:345)
       at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:309)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:360)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1343)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)

I've tried with with Spring 2.5.2 and 2.5.3 with JDK 1.5. We're using
"@AspectJ" so <aop:aspectj-autoproxy/> is set, and aspectjweaver.jar
and aspectjrt.jar are included. The Spring IDE shows that AOP advise
is applied to expected pointcuts. When compiled and run outside of the
Spring IDE, the application encounters the NPE.

Ideas?
Comment 1 Andrew Clement CLA 2008-03-17 14:07:05 EDT
Created attachment 92723 [details]
patch class file for weaver

This class replaces the one in aspectjweaver.jar, to apply

jar -xvf patch.zip
jar -uvf aspectjweaver.jar org

The new version will output DEBUG info to System.err indicating the method it is having problems with - it will also attempt to continue rather than crash with an NPE.

This patch is for aspectjweaver.jar from AspectJ1.5.4 - it will not work if applied to later versions of AspectJ.
Comment 2 Chris W CLA 2008-03-17 14:28:41 EDT
Thanks for the quick response, Andy.

I tried the aspectjweaver.jar found in the following bug.  The jar outputted the same or similar information, but unfortunately  I did not find relevant output in Eclipse's or plugin's log.  I'll give your attachment a go.

http://jira.springframework.org/browse/SPR-4390

Note: I also tried aspectj*.jar from the latest 1.6 download.

-Chris
Comment 3 Andrew Clement CLA 2008-03-20 14:02:40 EDT
I have now committed a guard into the codebase for the NPE - but I still think it will error when this situation happens.  But at least it may give out a sensible error rather than NPE.
Comment 4 Chris W CLA 2008-03-20 14:50:38 EDT
Thank you.  I'll add the jars and give it a spin and report back.  Sorry I haven't tried the patch yet - been pulled away.

Again, thanks for your speedy response.
Comment 5 Andrew Clement CLA 2008-03-20 17:45:15 EDT
unfortunately the build machine is complaining so it wont be in a dev build yet - i will post again when it is available for download.
Comment 6 Andrew Clement CLA 2008-03-21 13:10:31 EDT
ok, build machine resurrected.  The latest dev build from the download page includes the changes.
Comment 7 Andrew Clement CLA 2008-03-25 13:06:10 EDT
missing 1.6.0 - once diagnostics are collected, a fix can go into 1.6.1
Comment 8 Andrew Clement CLA 2008-06-11 18:32:54 EDT
still seeing this problem Chris?
Comment 9 Andrew Clement CLA 2008-08-28 12:00:05 EDT
NPE can't happen with the guard that is now in the dev builds of AspectJ - however that may have simply been hiding some underlying problem.  Please reopen if you get a chance to try this again and it still fails for you.

I would also say there were some issues with multi-threaded problems in the ReflectionBasedReferenceTypeDelegate types - and they have also been addressed in this timeframe (bug 227029) - that may have been a factor here.