Community
Participate
Working Groups
java.lang.NullPointerException at org.aspectj.weaver.ReferenceType.getTypeVariables(ReferenceType.java:738) at org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.fixUpCircularDependencies(BcelGenericSignatureToTypeXConverter.java:221) at org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(BcelGenericSignatureToTypeXConverter.java:42) at org.aspectj.weaver.bcel.BcelObjectType.ensureGenericSignat ... oBuildJob.run(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: NullPointerException thrown: null
Created attachment 144199 [details] aspects causing the exception. Aspects build properly, but exception occurs when added as aspectpath to another project, or during LTW
Resolved exception. NullPointerException occurred due to the following: privileged public abstract aspect DatabaseOperationMonitor<T extends AggregatedDatabaseStats<T>> extends BaseOperationMonitor<T> {... Null pointer occurred due to a circular dependency in generic type T above. Will be good if this is detected and resolved at compile-time instead of at weave-time.
Can make it happen all on the command line using: ---DatabaseOperationMonitor.java --- privileged public abstract aspect DatabaseOperationMonitor<T extends AggregatedDatabaseStats<T>> extends BaseOperationMonitor<T> {} class BaseOperationMonitor<P> {} class AggregatedDatabaseStats<Q> {} class Wibble extends AggregatedDatabaseStats<Wibble> {} aspect Foo extends DatabaseOperationMonitor<Wibble> {} --- ajc -1.5 DatabaseOperationMonitor.java -d bin ajc -inpath bin -1.5 This simulates what LTW is doing which is loading the aspect definition from a .class file. java.lang.NullPointerException at org.aspectj.weaver.ReferenceType.getTypeVariables(ReferenceType.java:738) at org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.fixUpCircularDependencies(BcelGenericSignatureToTypeXConvert er.java:221) at org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(BcelGenericSignatureToTypeXConverte r.java:42) at org.aspectj.weaver.bcel.BcelObjectType.ensureGenericSignatureUnpacked(BcelObjectType.java:708) at org.aspectj.weaver.bcel.BcelObjectType.getDeclaredInterfaces(BcelObjectType.java:226) at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:569) at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:66)
There is nothing wrong with the recursive nature of the definition, but AspectJ doesn't cope with it very well. I've committed a fix. It looks like entries were being cached in the world typemap that should never have made it there. I've added an isCacheable() method to ResolvedType so that some subtypes are not cached (in this case FTPHolder).