New Eclipse feature: See return value during debugging

Selection_121.png

With a recent patch, Eclipse can now show you the return value of a method during a debug session.

For years, when I was debugging and I needed to see the return value of a method, I would change code like:


return function();

 

To:

String retVal = function();
return retVal;

And then step through the code and inspect the value of “retVal”.

Recently [September 2016] a patch was merged to support this feature. Now when you return from a method, in the upper method, in the variable view it shows the return value of the previously finished call:

Selection_120.png

As a side note, the reason this was not implemented sooner is that the Java virtual machine debugger did not provide this information until Java 1.6.

If your version of Eclipse doesn’t yet have that feature, try downloading a recent integration or nightly build.

Happy debugging.