Bug 114744 - NPE at CaptureBinding.java on wildcard in intertype field type
Summary: NPE at CaptureBinding.java on wildcard in intertype field type
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M4   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-02 07:56 EST by Aske Simon Christensen CLA
Modified: 2005-11-03 03:25 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 Aske Simon Christensen CLA 2005-11-02 07:56:02 EST
When compiling this program with ajc -1.5

public aspect Wildcard {
    Class<? extends Wildcard> Wildcard.cl;

    void foo() throws Exception {
	Wildcard ci = cl.newInstance();
    }
}

ajc throws this exception

java.lang.NullPointerException
        at
org.aspectj.org.eclipse.jdt.internal.compiler.lookup.CaptureBinding.initializeBounds(CaptureBinding.java:75)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.capture(ParameterizedTypeBinding.java:105)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleNameReference.resolveType(SingleNameReference.java:772)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:293)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:199)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:422)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:178)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:400)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1076)
        at
org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration.resolve(AspectDeclaration.java:114)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1125)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:305)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:514)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:329)
        at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:759)
        at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:225)
        at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:151)
        at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
        at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
        at org.aspectj.tools.ajc.Main.run(Main.java:326)
        at org.aspectj.tools.ajc.Main.runMain(Main.java:240)
        at org.aspectj.tools.ajc.Main.main(Main.java:83)
Comment 1 Andrew Clement CLA 2005-11-02 07:59:29 EST
thanks for the clear bug report - don't think you could write a much smaller
testcase ;)
Comment 2 Andrew Clement CLA 2005-11-02 11:16:35 EST
Fix checked in.  The problem was in the conversion process between eclipse types
and aj types.  If it is not an ITD then no conversion takes place but if it is
an ITD then the conversion process was losing some information about the type
variable behind '? extends Wildcard'  (which is 'T extends Object' from the
generic type Class).

I worry there are a few other bugs lurking in that conversion process :(

fix checked in, waiting on build.
Comment 3 Andrew Clement CLA 2005-11-03 03:25:16 EST
fix available.