Bug 83930 - ResolvedTypeX.java:131 NullPointerException
Summary: ResolvedTypeX.java:131 NullPointerException
Status: RESOLVED DUPLICATE of bug 85097
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.5.0 M3   Edit
Assignee: Andrew J Huff CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-28 09:04 EST by Sjoerd Hemminga CLA
Modified: 2005-04-12 06:09 EDT (History)
0 users

See Also:


Attachments
Source-tree that triggers the bug (19.76 KB, application/zip)
2005-01-28 09:09 EST, Sjoerd Hemminga CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sjoerd Hemminga CLA 2005-01-28 09:04:08 EST
I encountered a NullPointerException:

java.lang.NullPointerException
        at
org.aspectj.weaver.ResolvedTypeX.isConvertableFrom(ResolvedTypeX.java:131)
        at org.aspectj.weaver.bcel.Utility.appendConversion(Utility.java:241)
        at org.aspectj.weaver.bcel.BcelVar.appendLoadAndConvert(BcelVar.java:61)
        at org.aspectj.weaver.bcel.BcelAdvice.getAdviceArgSetup(BcelAdvice.java:314)
        at
org.aspectj.weaver.bcel.BcelAdvice.getAdviceInstructions(BcelAdvice.java:270)
        at
org.aspectj.weaver.bcel.BcelShadow.weaveAfterReturning(BcelShadow.java:1380)
        at org.aspectj.weaver.bcel.BcelAdvice.implementOn(BcelAdvice.java:138)
        at org.aspectj.weaver.Shadow.implementMungers(Shadow.java:451)
        at org.aspectj.weaver.Shadow.implement(Shadow.java:334)
        at
org.aspectj.weaver.bcel.BcelClassWeaver.implement(BcelClassWeaver.java:1157)
        at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:362)
        at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:83)
        at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:742)
        at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:707)
        at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:634)
        at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:565)
        at
org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave(AjCompilerAdapter.java:243)
        at
org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling(AjCompilerAdapter.java:118)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:383)
        at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:682)
        at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:168)
        at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:102)
        at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:109)
        at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
        at org.aspectj.tools.ajc.Main.run(Main.java:291)
        at org.aspectj.tools.ajc.Main.runMain(Main.java:227)
        at org.aspectj.tools.ajc.Main.main(Main.java:80)
Comment 1 Sjoerd Hemminga CLA 2005-01-28 09:09:19 EST
Created attachment 17551 [details]
Source-tree that triggers the bug

Run ./compile to trigger the bug. It fails on compiling TestMain.java. I
suspect it has something to do with Trace.java, since that's the only file
that's been changed between compiles (the after returning rules have been
added). (Note that I'm new to AspectJ/AOP, so I may behave stupidly in my
program ;-)

Other aspects are in CalculateSum.java and CheckColours.java. There's a dump in
the ZIP-file too.

The code requires Java 5 features (enums), so that's why some stuff is compiled
with javac.
Comment 2 Sjoerd Hemminga CLA 2005-01-28 09:11:59 EST
Also, I'm using javac 1.5.0 and ajc 1.5.0 M1.

sjoerd@cicero:~$ ajc -version  
AspectJ Compiler 1.5.0 M1 built on Friday Dec 10, 2004 at 15:10:44 GMT
sjoerd@cicero:~$ javac -version
javac 1.5.0
Comment 3 Sjoerd Hemminga CLA 2005-01-28 10:10:08 EST
If in the following code ...

  after (CarComponent c) returning (boolean match): target (c) && traceCol () {
    System.out.println ("Leaving " + c + ": " + match);
  }

... "(boolean match)" is left out, the code compiles (well, if you don't use
match later on). But that doesn't allow me to use the match variable, which of
course I do want :-) Empty parentheses do work, different types or names don't.

I worked around the problem by using (how appropriate) the around () advice.
Comment 4 Adrian Colyer CLA 2005-03-23 09:27:51 EST
for verification and fixing if needed in aj5m3...
Comment 5 Andrew Clement CLA 2005-04-11 12:17:50 EDT
Reassigning to Andrew for investigation.  It is likely due to 'boolean' since
they are represented as a special kind of ResolvedTypeX and have only been
referenced in the isConvertableFrom code since I wrote the autoboxing changes
for 1.5.0.
Comment 6 Andrew J Huff CLA 2005-04-12 06:09:36 EDT
Already fixed as bug 85097 - closing as dup - fix available in 1.5.0M2.

*** This bug has been marked as a duplicate of 85097 ***