How to distinguish generated methods (AspectJ)

153 views Asked by At

I am currently using aspectJ @Around in order to inspect my code. I am using aspectJ compiler in order to weave the aspects. BUT, in runtime, I am analyzing also the structure of classes using reflection type.getDeclaredMethods(). BUt i need to distinguish, which methods were originally present and which were added by the aspectJ compiler. Is it possible? Or is there some workaround?

Thanks in advance.

1

There are 1 answers

0
SpaceTrucker On BEST ANSWER

You can check if the members generated by AspectJ are synthetic. If that is not the case, you could generate an annotation for the methods that are target of a pointcut. During reflection you can filter members having such an annotation.