Community
Participate
Working Groups
ajc crashes with a NullPointerException when an intertype declaration tries to modify an inner class, if the enclosing (outer) class is generic: class Outer { class Inner {} } class Generic_Outer<T> { class Inner {} } aspect Injector { int Outer.outer; // works int Outer.Inner.inner; // works int Generic_Outer.outer; // works int Generic_Outer.Inner.inner; // crashes } /home/user/sgelin3/dev/java/ajc/new_bug/Bug.java [error] Internal compiler error java.lang.NullPointerException at org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.fromBinding(EclipseFactory.java:202) at org.aspectj.ajdt.internal.compiler.ast.InterTypeFieldDeclaration.build(InterTypeFieldDeclaration.java:173) at org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration.buildInterTypeAndPerClause(AspectDeclaration.java:1020) at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.buildInterTypeAndPerClause(AjLookupEnvironment.java:306) at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.completeTypeBindings(AjLookupEnvironment.java:122) at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:302) at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:316) ...
I've sent quite a few bug reports on the interaction of ITD with generics, so by now I know that they all get "1.5.0 M3" as a target. I'd save you the trouble of setting that target every time but: "You tried to change the Target Milestone field from --- to 1.5.0 M3, but only the owner or submitter of the bug, or a sufficiently empowered user, may change that field." strange, since I _am_ the submitter of the bug! anyway, sorry to bother you with so many similar looking bugs (98320, 98592, 99168, 99228 and now 100227), I know that I am not supposed to expect generics to work completely until M3, and keep up the good work!
Its great that you are spending time creating these minimal testcases for bugs that I can work on, keep it up! You are bound to hit something we've not created testcases for yet. In this case it appears there is a special form of ParameterizedTypeBinding known to the compiler. It is a PTB whose arguments (type parameters) are null - this doesn't mean it is a raw type as raw type is a subtype of ParameterizedTypeBinding. From a quick look round the JDT compiler, it *looks* like a PTB with null arguments represents an inner type of a parameterized type that itself specifies no type parameters. Presumably it 'inherits' any from the enclosing type. So, the fix is to allow for null type parameters - and ensure we don't misintepret the null as a raw type ref.
Fix checked in, waiting on build.
Dev build available from the download page: aspectj-DEVELOPMENT-20050620091600.jar