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.

 

 

One thought on “New Eclipse feature: See return value during debugging

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s