Bug 185447

Summary: [plan] [ataspectj] Abstract @Aspect causing problems
Product: [Tools] AspectJ Reporter: John D. Heintz <john.heintz>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: aclement
Version: DEVELOPMENT   
Target Milestone: 1.6.3   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Eclipse projects to demonstrate problem none

Description John D. Heintz CLA 2007-05-03 17:18:07 EDT
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[])
Comment 1 John D. Heintz CLA 2007-05-03 17:19:46 EDT
Created attachment 65849 [details]
Eclipse projects to demonstrate problem
Comment 2 Andrew Clement CLA 2008-12-01 16:01:52 EST
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.