Hi,
I’m developing a set of policies to enforce good practices,
with AspectJ. Today I run into a problem that, I suppose, is most likely to be
a limitation of AspectJ itself.
I was trying to match an annotation with Source retention in
a declare warning. Can I do this? I already search the notebook at:
http://www.eclipse.org/aspectj/doc/released/adk15notebook/annotations-decp.html#declare-error-and-declare-warning
I noticed that, in declare parents, its explicitly referred
that “it is now possible to match types based on the presence of annotations
with either class-file or runtime retention”. However nothing is said about
Source retention.
A simple test example that I developed is:
Class A and B:
public class A {
public void foo() { //doSomething }
}
public class B extends A{
@Override
public void foo() { //doSomethingDifferent }
}
Aspect
public aspect Enforcer {
declare warning: execution(@Override * *(..)) : "Overriding Method!";
}
The problem here is the use of an Annotation with RetentionPolicy
= SOURCE, right? Is there any way of matching this annotations? Or is it really
a limitation of the language itself?
Regards,
Tiago Moreiras