1

I know you can specify code to be run in a wide variety of situations like when an exception is throw, method is executed, method is called, etc.

Is there any way that I can specify code to be run after every single line of execution of a given method?

Ogen
  • 6,499
  • 7
  • 58
  • 124

1 Answers1

1

No. How would AspectJ know how to do that? One line of Java code can be compiled into one or multiple Java bytecode statements. And why would you want to do this anyway? Better learn how to use a debugger.

kriegaex
  • 63,017
  • 15
  • 111
  • 202
  • Yeah but I want it to be an in built debugger kinda. Basically as part of the actual code that is running rather than running in debugging mode. – Ogen Jul 04 '16 at 07:57
  • Have you considered the fast that an AspectJ advice which runs for every possible pointcut creates an awful lot of byte code, consumes runtime and basically bloats the code? You don't want that for your production code, but rather for some kind of trace mode. – kriegaex Jul 04 '16 at 10:58