Community
Participate
Working Groups
I have an abstract aspect, where I define my point cuts, and 2 derived concrete aspects that use the pointcuts to implement advice. On building in eclipse and running findbugs I get the following bad practice bug Superclass uses subclass during initialization. I looked at the byte code and I can see that the abstract aspect had references to the concrete aspects. The reason was an overly broad definition of pertypewithin. Below is a toy code sample that results in this findbugs error package bar; public abstract aspect AbstractAspect pertypewithin(bar..*) { pointcut loginitialization() : staticinitialization(bar..*); pointcut loggedMethods() : (within(bar..*)) && execution(* *.*(..)); } package bar; public aspect ConcreteAspect extends AbstractAspect { after() : loginitialization() {} before() : loggedMethods() {} after() : loggedMethods() {} } The AbstractAspect satisfies the pertypewithin scope and is advised by ConcreteAspect.after():loginitialization Having a concrete aspect advice a abstract aspect that it inherits seems to be an anti-pattern (at least when using pertypewithin), which is really the reason for FindBugs to be complaining. Requested Enhancement : Aspectj compiler should report an appropriate warning indicating such a scenario. Attachment contains a small eclipse project to reproduce the issue.
Created attachment 84818 [details] Simple eclipse project zipped to reproduce the error
unsetting the target field which is currently set for something already released