I'm wondering if there is a way to look at the values of non-declared variables as they get passed into a function, after that function has been executed. For example, if I am debugging and the line
foo.setBar(baz.getBar());
has already been passed (but is still within scope), how can I see the value of what got passed in to setBar()
? I know that I can see this many other ways, for instance by stepping into the setBar()
call, or by assigning baz.getBar()
to a temporary variable - but that's not what I'm asking.
Edit: Basically, I feel penalized (by losing the ability to see certain information) while debugging, just because I'm not declaring every variable.
And, I know I could inspect bar
after the fact (if I know it hadn't changed) but in this case it's not so simple because I'm dealing with objects that aren't just POJOs or JavaBeans (the object that brought this question up is an HTTP request - and yes, I already did try inspecting it).
Press Ctrl+Shift+d or Ctrl+Shift+i on a selected variable or expression to show its value. You can also add a permanent watch on an expression/variable that will then be shown in the Expressions view when debugging is on.
Variables. We can see the values of variables during the execution under the Variables view. In order to see the static variables, we can select the drop-down option Java -> Show Static Variables. Using the variables view, it's possible to change any value to the desired value during the execution.
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.
A by far easier way is to select an expression (here: baz.getBar()) and press CTRL+SHIFT+I (for inspect). This opens a tooltip like window with all you want to know.
And of course you can use "Expressions" view (Window -> Show View -> Expressions).
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