Community
Participate
Working Groups
Trying to use an abstract @Aspect from a library jar file is causing problems. In the (soon to be) attached zip of eclipse projects: * logging-library: defines two abstract trivial logging aspects, one in code-style and one in @AspectJ style. * sample-system: uses the code-style abstract aspect successfully * sample-system2: uses the @AspectJ style abstract aspect and won't compile in Eclipse Exception: java.lang.NullPointerException at org.aspectj.weaver.bcel.AtAjAttributes$LazyResolvedPointcutDefinition.getPointcut(AtAjAttributes.java:1632) at org.aspectj.weaver.ShadowMunger.addChildNodes(ShadowMunger.java:258) at org.aspectj.weaver.ShadowMunger.createHierarchy(ShadowMunger.java:247) at org.aspectj.weaver.AsmRelationshipProvider.adviceMunger(AsmRelationshipProvider.java:180) at org.aspectj.weaver.Shadow.implementMungers(Shadow.java:717) a ... int;)Ljava/lang/String; ARETURN end public Object run(Object[])
Created attachment 65849 [details] Eclipse projects to demonstrate problem
recreated on latest dev build with this command line: ajc -emacssym -1.5 -sourceroots src -aspectpath ..\logging-library\logging-library.jar whilst in the sample-system2 folder. Stack trace has moved: java.lang.NullPointerException at org.aspectj.weaver.bcel.AtAjAttributes$LazyResolvedPointcutDefinition.getPointcut(AtAjAttributes.java:1527) at org.aspectj.weaver.model.AsmRelationshipProvider.addChildNodes(AsmRelationshipProvider.java:285) at org.aspectj.weaver.model.AsmRelationshipProvider.createHierarchy(AsmRelationshipProvider.java:274) Problem here is the lazy resolution mechanism that is used for annotation style pointcuts does not cope well with abstract pointcuts (which have components represented by nulls). I've fixed the code to allow for this. Making the annotation style pointcut non-abstract also stops this happening, but isn't really a helpful workaround. I suspect this only happens in the IDE since AsmRelationhshipProvider (present in the stack trace) wouldn't be used if everything was being built on the command line.