Bug 91267 - NPE at EclipseFactory.java:143 when using generic methods in aspects
Summary: NPE at EclipseFactory.java:143 when using generic methods in aspects
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.5.0 M3   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-13 09:29 EDT by Aske Simon Christensen CLA
Modified: 2005-05-09 03:21 EDT (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-04-13 09:29:09 EDT
When I compile any of these two aspects with ajc -1.5, an exception is thrown by
the compiler:


import java.util.*;

public aspect TestBug1 {
    static <T> void addToEnv(Map<String,T> env, String key, T value) {
	env.put(key, value);
    }
}


import java.util.*;

public aspect TestBug2 {
    static <T> T lookupEnv(Map<String,T> env, String key) {
	return env.get(key);
    }
}


If the methods are placed into classes instead of aspects, all works fine.

The exception thrown is the following:

java.lang.NullPointerException
        at
org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.getName(EclipseFactory.java:143)
        at
org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.fromBinding(EclipseFactory.java:166)
        at
org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.fromBindings(EclipseFactory.java:176)
        at
org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.makeResolvedMember(EclipseFactory.java:254)
        at
org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.makeResolvedMember(EclipseFactory.java:249)
        at
org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.fillDeclaredMembers(EclipseSourceType.java:115)
        at
org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.getDeclaredPointcuts(EclipseSourceType.java:146)
        at
org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration.buildInterTypeAndPerClause(AspectDeclaration.java:977)
        at
org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.buildInterTypeAndPerClause(AjLookupEnvironment.java:303)
        at
org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.completeTypeBindings(AjLookupEnvironment.java:119)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:331)
        at
org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:348)
        at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:683)
        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 Andrew Clement CLA 2005-04-13 09:46:31 EDT
Full generics support is targetted for M3, so I've set the target for fixing
this appropriately.  thanks for the bug report!
Comment 2 Andrew Clement CLA 2005-05-06 06:25:19 EDT
Fixed in CVS - will be in next dev build.

Problem is us not processing eclipse 'TypeVariableBinding' objects correctly -
I've enhanced our support to fix this case but it is not complete, in going from
a TVB to a TypeX we are losing information about it being a type variable that I
think we'll need later.  When I hit a bug that requires it, I'll fully upgrade
TypeX.
Comment 3 Andrew Clement CLA 2005-05-09 03:21:47 EDT
Fix available, see AJ downloads page:

http://eclipse.org/aspectj/downloads.php