Bug 51919 - Polymorphic ITD fails in CVS HEAD (From ajdt 1.1.6)
Summary: Polymorphic ITD fails in CVS HEAD (From ajdt 1.1.6)
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.2   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 51902 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-12 18:12 EST by Ron Bodkin CLA
Modified: 2004-02-24 05:12 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2004-02-12 18:12:48 EST
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
Comment 1 Ron Bodkin CLA 2004-02-12 18:14:03 EST
*** Bug 51902 has been marked as a duplicate of this bug. ***
Comment 2 Andrew Clement CLA 2004-02-23 15:38:02 EST
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.
Comment 3 Andrew Clement CLA 2004-02-24 05:12:57 EST
Fix checked in.