Hi,
I have started to look into aspectj , now that I have a working dev environment in Eclipse 😊
I want to find which classes and methods outside our application that calls to our application classes with public methods that has annotation @Deprecated.
I have created the following 'pointcut':
pointcut deprecatedMethods() : call(public * *.*(..)) && @withincode(Deprecated);
before() : deprecatedMethods() {
log("[Deprecated Method Usage]" +" --> "+ thisEnclosingJoinPointStaticPart.getSignature().toShortString+"\n");
}
The above will give something like:
[Deprecated Method Usage] --> HandlerImpl.getBoards(..)
I can see which classes' methods with @Deprecated gets called. But I cannot see what the name of the enclosing class and method is, in this case Demo.test() ( see below).
- Is it possible to get this using aspectj?
- What would be the correct pointcut to use?
br.
//mike
public class Demo extends Test{
@Test
public void test() {
Node node = new Node();
Handler handler = node.getObjectHandler();
//getBoards() is the deprecated method.
Boards boards = handler.getBoards();
}
}