While debugging in Eclipse, it would be useful for me to avoid the side effects of a void function by just doing a force return (which I have done before with a non-void method).
However, the context menu item is always disabled when I try to return from a void method. Specifically, I tried going into the Display pane while debugging, enter a value I'd like to return, right-click and select "Force Return". Obviously, a void method is not supposed to return anything so I can understand why this menu item is disabled.
Does anyone know of a way to do this, or does some feature of Java prohibit me from doing it?
Open Debug Configuration -> Debugger -> Enable Reverse Debugging at startup . Than you can press shift+F5 or shift+F6 for step back like F5 or F6 for step forward.
Eclipse allows running an application in Debug mode which helps with stepping through each line of code in a program. Eclipse also provides a Debug Perspective which is a set of views grouped together that help inspect code and make the debugging process very effective.
1.4. To debug your application, select a Java file with a main method. Right-click on it and select Debug As Java Application. If you started an application once via the context menu, you can use the created launch configuration again via the Debug button in the Eclipse toolbar.
Going to a previously step is not possible in debugging... only option have a new break-point at that point and re-start debugging...
Yes, you can do this, don't use the context menu in the Variable display, but right-click in your code and you will see "Force Return" in the context menu.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With