Bug 185447 - [plan] [ataspectj] Abstract @Aspect causing problems
Summary: [plan] [ataspectj] Abstract @Aspect causing problems
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 1.6.3   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-03 17:18 EDT by John D. Heintz CLA
Modified: 2008-12-01 16:01 EST (History)
1 user (show)

See Also:


Attachments
Eclipse projects to demonstrate problem (12.17 KB, application/zip)
2007-05-03 17:19 EDT, John D. Heintz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.