I have to prevent using specific annotations in my project. Due to some specific circumstances, I have to prevent using org.junit.After annotation in project test classes. If anyone uses this annotation, whole tests logic will be violated.
It doesn't matter for me if it will happen during compilation or at runtime. My idea was to create aspect using Spring AOP which throws an exception on call After annotated method. Unfortunately, test classes are not Spring beans so AOP will not work here.
How can I do that? Is it possible to put some compilator directives which will prohibit using specific annotation?
@Afterannotation.