Is there any way by using JDT ASTParser, by which we can identify if the method declaration is inside the Anonymous inner class?
I am creating a Eclipse plug-in to find unused public methods in a project. I am using a ASTVisitor on the MethodDeclaration node and then using the JDT search. The problem is that while traversing through each Java Class i am visiting MethodDeclaration of anonymous inner classes like Listeners. I need to avoid these methods.
Thanks in advance.
At last i found a solution. There is a AnonymousClassDeclaration ASTNode in ASTParser which denotes the anonymous inner classes in the Java file. When visiting such nodes we can specify that these nodes need not be visited entirely (by returning false).