Set a breakpoint to cover all return statements of a method in IntelliJ

Sebastian :

I have a quite huge equals method in java with a bunch of return false statements and one return true at the end.

I want to see exactly where the method was exited to know which field was not equal. Is there a way to simple add a breakpoint on method exit regardless of where the method is acutally exited?

I know I could add breakpoints to each return statement but I hope there is an easier way.

kamentk :

Try to place a breakpoint on the line where you declare the method.

e.g public boolean test() {

The debugger should brake 2 times. When the method is called and when the method finishes on one of the return statements. This should work for you.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=87750&siteId=1