Project: AspectJ
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
Reported: 2006-07-31 18:31:46 | Status: resolved fixed

I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.

Files changed in fix:
bridge/src/org/aspectj/bridge/MessageUtil.java