I would like to make a few classes extending JPanel actually extend a class of my own in between.
So, I tried this:
public aspect MyAspect
{
public static class MyPanel
extends JPanel
{
}
declare parents: JPanel+ extends MyPanel;
}
As is, it works. The only issue is that the aspect matches any class extending JPanel, whereas I want it to apply only on the JPanel+ classes from a package.
So I tried this:
public aspect MyAspect
{
public static class MyPanel
extends JPanel
{
}
declare parents: my.package..JPanel+ extends MyPanel;
}
and it doesn't match any JPanel+ at all ...
On the other hand I tried to target a particular JPanel+ class explicitly in a package from my.package.. and it works for this particular class, so the package path is understood by AspectJ.
I just don't understand why it won't work with my.package..JPanel+?
Just my.package..JPanel (without the +) would be understandable as no JPanel exists there, but why doesn't my.package..JPanel+ work as expected (by me!)?
By the way, my.package..*_suffixFilterOnClassName works, but it really is not ideal in my opinion.
From https://eclipse.dev/aspectj/doc/released/adk15notebook/annotations-decp.html, I understand I could use an annotation as a workaround, but it's not that great either. But it would be better than just the suffix filtering.
Also, it would have been nice if the usual syntax within/withincode & so on from the pointcuts+declare warning+errors would work as for the others pointcuts, but as far as I understand the declare parents is implemented with TypePattern only!
Thanks in advance for any help!