I'm getting unexpected behavior in my Android 1.5 application under the Windows emulator and debugging with Eclipse. Here's a generalization of what the code is doing:
if (someCondition) {
System.out.println("got here");
return "a";
}
if (someOtherCondition)
return "b"
return "c";
If I step through this code with the debugger, if someCondition
is true it outputs "got here" but then jumps to the final return statement as if it's going to execute that line. From what I can tell, it is returning "a" but it's confusing because it seems like it is going to return "c."
If someCondition
is false, and someOtherCondition
is true, the debugger steps to the return "b"
line - it doesn't jump to the final return statement and then leaves the method as expected.
As I mentioned, it seems like it is always returning the expected behavior but the fact that the debugger jumps to the wrong line had me chasing phantom bugs. A full rebuild, restarting Eclipse and restarting Windows each didn't address the problem - it's fully re-createable.
Any ideas?