Search code examples
javadebuggingintellij-ideabreakpoints

Simulate return while debugging intellij


Is there any way to return from the current step during execution in debug mode and not to stop the app? I see this like debugger should insert return statement when you press the 'exit button' for example.

The main usecase of this behaviour is in fast response of refactoring\rewriting of long methods; when you want to test first part of it and not to trigger save\update\delete actions at the end of it.

The question is concerned Intellij primarily, but other IDEs experience also is interesting.


Solution

  • IntelliJ 15 (which is in Release candidate stage as of writing this post) has debugger feature called Force early return which does exactly what you want.

    You can explicitly specify which value to return and choose whether you want to invoke any finally blocks. More information about this feature can be found on IntelliJ blog.