Community
Participate
Working Groups
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
By some coincidence, I fixed something like this earlier on today - it manifested for me because I had some aspects on my aspectpath that used the same package name as source in my project, but I believe it could also happen if using split packages where source code in two different source folders shares the same package name. Do you have that situation? The fix was to AspectJElementHierarchy - to make it continue searching even after finding a match in case there are others. The proposed fix has not made it into an AJDT dev build yet but it should do shortly. (bug I raised to cover it was bug 269840)
> By some coincidence, I fixed something like this earlier on today - it > manifested for me because I had some aspects on my aspectpath that used the > same package name as source in my project, but I believe it could also happen > if using split packages where source code in two different source folders > shares the same package name. Do you have that situation? > I do indeed. > The fix was to AspectJElementHierarchy - to make it continue searching even > after finding a match in case there are others. The proposed fix has not made > it into an AJDT dev build yet but it should do shortly. (bug I raised to cover > it was bug 269840) > Is there a development plugin build produced automatically somewhere? Or maybe some documentation on how to c/o and compile? Happy to test the fix to see if it applied to my case before I go too deep into the source.
the ajdt builds are currently failing some tests (my fault). But let me work out how to give you a patch for this.
Created attachment 129779 [details] Replacement class file This replaces the version in the org.aspectj.weaver plugin. Shutdown eclipse, go to your eclipse installation folder, then the plugins directory. Within their go to org.aspectj.weaver_XXX - go into the latest version you have. backup the weaver jar: cp aspectjweaver.jar aspectjweaver.jar.original apply the patch: jar -xvf patch266902.zip jar -uvf aspectjweaver.jar org This will replace the .class file in that jar with a build of the latest version from HEAD. Let me know what happens...
Thanks for that, unfortunately same NPEs still coming up. Happy to test further or debug if you have a guide on how to debug the compiler.
i'll look at it next after what I'm working on. If you have a minimal project that exhibits the problem, that would be great.
you could try the latest AJDT 1.6.5 dev build that has just been made available.
(In reply to comment #7) > you could try the latest AJDT 1.6.5 dev build that has just been made > available. > Similar error with the dev build, one line difference in the location of the NPE: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:167) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1735) at org.aspectj.weaver.b ...
ah, it is similar to the npe i fixed but not on exactly the same line, I should have checked. I suspect it has a similar root cause though, hopefully now I have an up to date stack trace I'll be able to recreate - thanks!
i've recreated it, yey.
hmm, well i only managed a recreate by using a broken aspect (that had syntax errors in it). But anyway - I've put guards in place to prevent the NPE, this change is in todays AJDT dev build that includes AspectJ 1.6.4.20090326115100
(In reply to comment #11) > hmm, well i only managed a recreate by using a broken aspect (that had syntax > errors in it). But anyway - I've put guards in place to prevent the NPE, this > change is in todays AJDT dev build that includes AspectJ 1.6.4.20090326115100 > That seems to have remove the NPE, thanks. FWIW, all of my advice is applied using annotations and they compile and weave fine with a stand-alone ant task. Entirely possible that something is wrong with them, but it doesn't surface when outside the AJDT context. I seem to now be encountering 267794 so its hard for me to know if I'm entirely out of the woods yet, but appreciate the help.
Running with Ant outside of eclipse you aren't building a structure model (which drives the markers/etc in eclipse) - so you don't trigger the codepath that leads to the NPE. Are you really hitting an OutOfMemory problem? Please can you comment on that bug with any details if you are...