Community
Participate
Working Groups
The following code causes the compiler to fail with a NPE in the version that was included in ajdt 1.1.6 (developer build). public aspect LogManager { public void Loggable.logTrace(Object message) { } // no crash if the next method on the next line is renamed public void Loggable.logTrace(Object message, Throwable t) { } } public interface Loggable { } Example crash: C:\eclipse\workspace\atrack>ajc -d build @isolateError.lst trouble in: ABORT Exception thrown from AspectJ DEVELOPMENT This might be logged as a bug already -- find current bugs at http://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler Bugs for exceptions thrown have titles File:line from the top stack, e.g., "SomeFile.java:243" If you don't find the exception below in a bug, please add a new bug at http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ To make the bug a priority, please include a test program that can reproduce this exception. null java.lang.NullPointerException at org.aspectj.weaver.bcel.LazyMethodGen.getSignature (LazyMethodGen.java :1225) at org.aspectj.weaver.bcel.BcelClassWeaver$1.compare (BcelClassWeaver.jav a:676) at java.util.Arrays.mergeSort(Arrays.java:1278) at java.util.Arrays.sort(Arrays.java:1219) at java.util.Collections.sort(Collections.java:155) at org.aspectj.weaver.bcel.BcelClassWeaver.weaveInAddedMethods (BcelClass Weaver.java:669) at org.aspectj.weaver.bcel.BcelClassWeaver.weave (BcelClassWeaver.java:35 2) at org.aspectj.weaver.bcel.BcelClassWeaver.weave (BcelClassWeaver.java:79 ) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:484) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:455) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:392) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.weaveAndGenerat eClassFiles(AjBuildManager.java:262) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild (AjBuild Manager.java:156) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild (AjBu ildManager.java:70) at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:102) at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:53) at org.aspectj.tools.ajc.Main.run(Main.java:231) at org.aspectj.tools.ajc.Main.runMain(Main.java:168) at org.aspectj.tools.ajc.Main.main(Main.java:81) 1 fail|abort
*** Bug 51902 has been marked as a duplicate of this bug. ***
This occurs because of an assumption in LazyMethodGen. It assumes for an intertype declaration, it can create a skeleton form of the LazyMethodGen. This means we don't create the necessary containing object (memberView) that has the method signature in it. The stack trace shows a call from a snippet of code that is used to compare intertype declarations. If the names for two intertype declarations are the same, it continues on to compare the signatures - because the memberView does not exist, the getSignature() method blows up NPE. The fix is to say that if the memberView is null, conjure up the right signature on the spot to allow the comparison to be done. I'll check the fix in tomorrow morning.
Fix checked in.