Java debugging: how to find the difference in the code flow paths?

Sometimes when debugging Java code, I find myself doing the following to find errors:

  • Place a breakpoint on a method call
  • Run the program in debug mode
  • Pay attention to the code flow path as a result of the method call
  • Change the parameters and run the program in debug mode
  • Again, pay attention to the code flow path from the point where the method is called
  • Find the difference between the paths of the code flows and the zero on the potential path with an error.

Is there a tool that facilitates this work by writing the code stream path to a file and comparing two such files?

+4
source share
3 answers

Try using something like emma, it is a unit test code coverage tool that should be able to tell you which classes have unused or unverified code codes.

There is a plugin available for eclipse that should contain a fairly concise report.

+1
source

You can use logging. If you encode source library paths out of your control, you can set a conditional breakpoint that prints a message and returns false.

+1
source

If you select a method name in Eclipse, right-click and select the links, you will see all possible cases when a call can be made with this method.

0
source

Source: https://habr.com/ru/post/1343929/


All Articles