1

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.

malejpavouk
  • 4,297
  • 6
  • 41
  • 67

1 Answers1

3

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.

SpaceTrucker
  • 13,377
  • 6
  • 60
  • 99