C# compiler insert nop instruction at '}' for debugging, so the
debugger can stop there.
i guss eclipse doesn't have this feature
As you can see from what Patricia wrote, the part about "so the
debugger can stop here" is not true - it can stop on method exit. You
are maybe right about the nop, I don't know, but there should be at
least the option to do this in Eclipse - i.e. to make code with nop
(or however else is possible) for debugging.
This is a bit indirect, but does not require any source code changes.
Create a breakpoint on the
void test() {
line. Right click the breakpoint indicator, select "Breakpoint
Properties", uncheck "Method Entry" and check "Method Exit".
When the breakpoint is hit, the indicator does point to the final
brace.
I have no idea why inserting a breakpoint on the final brace is not
treated as equivalent to this process.
Patricia
<
Thanks Patricia, this worked. Two things - this is "indirect", as you
said. It will certainly help me do what I wanted (my case is simple
enough for the above technique to be applied), but it still sucks and
this will not let you do the other thing - stop on the end of the
while loop. To make it a little clearer:
void test() {
boolean a = true;
while(a) {
if(otherMethodReturningBoolean())
a = false;
// other code here
boolean a = true;
while(b) {
if(otherMethodReturningBoolean())
b = false;
} // <--- Breakpoint here
} // <--- Breakpoint here
} // <--- Breakpoint here
Consider the two extra breakpoint possibilities (excluding method
end). How would you debug the end of while(b), while still staying in
while(a) iteration?
A digression - I tried NetBeans and it works, if I may say, as
expected. Thus, it's not a Java language or Java VM problem - it's an
Eclipse problem. Pardon me again for being so frustrated, but I really
am. I like Eclipse very, very much, but it is missing some really
basic things here and there. Maybe I am not thinking as the rest of
the world, but it seems that the rest of IDE developers think like
me
.
For example, take a look at what is sometimes called "virtual lines" -
being able to position the cursor anywhere on the line, regardless of
whether the line has enough characters for that column to exist. This
really helps when you scroll through the code (at least it helps me),
but Eclipse doesn't support that. Another thing - consider the
keyboard usage. You can use menus to call Search/File... function. Can
you do it using keyboard only? I couldn't find the way - if anyone
knows how to do this, please let me know. However, you can use Ctrl+H
to call Search/Search..., which is in fact Search/Java... option. What
frustrates me even more is that these features are so easy to
implement compared to e.g. real-time error checking, Java code
formatting or some of the numerous features I could list here.
It's like having a car which you couldn't start from inside using a
key, as common today, but you would have to go outside and use a hand
crank. Yes it works, but we have the keys now - get rid of the cranks.
Well, only my 2 cents... Disregard the rant, please - a pure product
of my frustration. Didn't want to offend anyone - if I did, please
forgive me! Let's do something useful.