logo       

FindBugs error in abstract aspect that uses pertypewithin: msg#01272

Subject: FindBugs error in abstract aspect that uses pertypewithin
Hello,

    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 used jclasslib to look at the byte code and I can see that the abstract aspect had references to the concrete aspects. The reason was a 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;

import java.util.logging.Level;
import java.util.logging.Logger;

public aspect ConcreteAspect
    extends AbstractAspect
{
    after() : loginitialization() {}
   
    before() : loggedMethods() {}
   
    after() : loggedMethods() {}
}

The AbstractAspect satisfies the pertypewithin scope and is advised by ConcreteAspect.after():loginitialization

My Question : Should'nt the aspectj compiler/weaver be reporting at least a warning in the case that an abstract aspect is adviced by a concrete sub-aspect? What makes this worse is that in the larger project where I first found this issue, neither the advice markers or crosscutting visualization view show anything to indicate that advice defined in concrete sub-aspects apply to the abstract parent aspect. Though they seem to work on my toy example. Trying to track down the reason for the warning using FindBugs is difficult since the by te code does not translate as easily to aspectj code.

Thanks
Bhaskar
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
<Prev in Thread] Current Thread [Next in Thread>