[ BUILD # : 200905160201 ]
[ JDK VERSION : 1.6.* ]
If stepping through a method by "Step over" until it returns to the
caller, the return value is not displayed.
I think this is unnecessarily annoying, that user has to use "Step
out" on the last statement of a method to get the return value
I think, it should also automatically be displayed when using "Step
This can not be a defect, it's a missing functionality, that can be requested as an enhancement.
The problem with this is implementation. We have no access to stack content (requested from JDK, but it's not going to
be implemented) and I do not want to add the overhead with method exit breakpoint (which is submitted in step out to get
the return value) to every step. Method exit breakpoint can be hit too many times, ironically, there's no way to
restrict it to a particular method.
Due to these facts, this will not be implemented anytime soon.
But can't you check the source line where debuggers step cursor (green arrow) is pointing to, and if there is a
"return", just execute "Step out", even if "Step over" is invoked from user?
Anyway, isn't it ugly to show "After return from ..." item in Variables window, if there is no value? Maybe it should be
suppressed in such case.
Is there a JDK Bug ID about this? I like to vote on it?
I agree with Ulf. If the breakpoint overhead is okay for "step out", I don't see why it shouldn't be okay for "step
over". Or if it is a problem, let the user decide by providing an additional "step over with return value".
One thing that probably needs to be considered with the breakpoint solution is recursive calls. If the breakpoint is
set before the call which is being "stepped over", it needs to be conditional on the stack depth, so that it doesn't
trigger on a nested call to the same method.
A whole different solution on the JDK level would be for the compiler to have an option to create hidden local
variables for intermediate results so that debuggers can inspect them. Of course that's a less attractive solution, and
likely problematic for expressions in static initializers and argument expressions to this() and super(). A true JVM-
based solution would certainly be better.